Files
lity3d/Engine/VisualScript/block_editor.h
T
shuiyu1123 2d56cb3bc9 MiMoEngine ASM: x86-64 MASM汇编+C混合架构游戏引擎
核心热路径(数学/内存/字符串/性能分析)用MASM汇编(SSE/AVX2)
外围系统(窗口/渲染/ECS/音频/UI/脚本)用C语言
含自研编辑器、VisualScript积木编程、中文渲染(glyph_atlas)
2026-07-10 19:20:40 +08:00

64 lines
2.0 KiB
C

#pragma once
// ============================================================================
// block_editor.h - 编辑器主界面
// ============================================================================
#include "block_workspace.h"
#include "block_renderer.h"
#include "block_interaction.h"
#include "block_palette.h"
#include "block_executor.h"
#include "block_serializer.h"
typedef struct BlockEditor {
BlockWorkspace* workspace;
BlockRenderer renderer;
BlockInteraction interaction;
BlockPalette palette;
BlockExecutor* executor;
int width, height;
int visible;
// 工具栏
int toolbar_height;
// 属性面板
int properties_width;
Block* selected_block;
} BlockEditor;
// 初始化/销毁
int block_editor_init(BlockEditor* editor, void* device, void* context, int width, int height);
void block_editor_shutdown(BlockEditor* editor);
// 显示/隐藏
void block_editor_show(BlockEditor* editor);
void block_editor_hide(BlockEditor* editor);
int block_editor_is_visible(BlockEditor* editor);
// 更新/渲染
void block_editor_update(BlockEditor* editor, double delta_time);
void block_editor_render(BlockEditor* editor);
// 输入处理
void block_editor_on_mouse_move(BlockEditor* editor, int x, int y);
void block_editor_on_mouse_down(BlockEditor* editor, int button);
void block_editor_on_mouse_up(BlockEditor* editor, int button);
void block_editor_on_mouse_wheel(BlockEditor* editor, int delta);
void block_editor_on_key(BlockEditor* editor, int key);
void block_editor_on_resize(BlockEditor* editor, int width, int height);
// 从面板拖拽创建积木
void block_editor_create_block_from_palette(BlockEditor* editor, BlockType type, float x, float y);
// 保存/加载
int block_editor_save(BlockEditor* editor, const char* filepath);
int block_editor_load(BlockEditor* editor, const char* filepath);
// 运行控制
void block_editor_run(BlockEditor* editor);
void block_editor_stop(BlockEditor* editor);
void block_editor_pause(BlockEditor* editor);