核心热路径(数学/内存/字符串/性能分析)用MASM汇编(SSE/AVX2) 外围系统(窗口/渲染/ECS/音频/UI/脚本)用C语言 含自研编辑器、VisualScript积木编程、中文渲染(glyph_atlas)
66 lines
1.8 KiB
C
66 lines
1.8 KiB
C
#include "../Engine/Core/engine.h"
|
|
#include "../Engine/Core/logger.h"
|
|
#include "../Engine/Core/timer.h"
|
|
#include "../Engine/Window/window.h"
|
|
#include "../Engine/Rendering/graphics_device.h"
|
|
#include "../Engine/include/engine_api.h"
|
|
#include "../Engine/ASM/math_c_fallback.h"
|
|
#include "../Engine/Editor/editor.h"
|
|
#include <stdio.h>
|
|
|
|
static GraphicsDevice* g_dev = NULL;
|
|
static Editor g_editor;
|
|
|
|
static void on_render(Engine* engine) {
|
|
if (!g_dev) return;
|
|
editor_update(&g_editor, (float)engine->delta_time);
|
|
editor_render(&g_editor);
|
|
graphics_device_present(g_dev);
|
|
}
|
|
|
|
static void on_key(Engine* engine, int key) {
|
|
if (key == VK_ESCAPE) engine_request_quit(engine);
|
|
}
|
|
|
|
int main(int argc, char* argv[]) {
|
|
(void)argc; (void)argv;
|
|
|
|
LOG_INFO("=== MiMo Engine Editor ===");
|
|
|
|
EngineConfig config = engine_default_config();
|
|
config.app_name = "MiMo Engine Editor";
|
|
config.vsync = 1;
|
|
config.window_width = 1440;
|
|
config.window_height = 900;
|
|
|
|
Engine* engine = engine_create();
|
|
if (!engine_init(engine, &config)) {
|
|
LOG_FATAL("Engine init failed");
|
|
return -1;
|
|
}
|
|
|
|
g_dev = graphics_device_create();
|
|
if (!graphics_device_init(g_dev, window_get_handle(engine->window), config.window_width, config.window_height, 1)) {
|
|
LOG_FATAL("D3D11 init failed");
|
|
return -1;
|
|
}
|
|
LOG_INFO("D3D11 device ready: %dx%d", config.window_width, config.window_height);
|
|
|
|
if (!editor_init(&g_editor, g_dev)) {
|
|
LOG_FATAL("Editor init failed");
|
|
return -1;
|
|
}
|
|
LOG_INFO("Editor initialized");
|
|
|
|
engine_set_render_callback(engine, on_render);
|
|
engine_set_key_callback(engine, on_key);
|
|
|
|
LOG_INFO("Running editor...");
|
|
engine_run(engine);
|
|
|
|
editor_shutdown(&g_editor);
|
|
graphics_device_destroy(g_dev);
|
|
engine_shutdown(engine);
|
|
return 0;
|
|
}
|