MiMoEngine ASM: x86-64 MASM汇编+C混合架构游戏引擎
核心热路径(数学/内存/字符串/性能分析)用MASM汇编(SSE/AVX2) 外围系统(窗口/渲染/ECS/音频/UI/脚本)用C语言 含自研编辑器、VisualScript积木编程、中文渲染(glyph_atlas)
This commit is contained in:
commit
2d56cb3bc9
91 files changed
+9988
No files matched your search
@@ -0,0 +1,70 @@
|
||||
#pragma once
|
||||
|
||||
// ============================================================================
|
||||
// block_executor.h - 积木执行引擎
|
||||
// ============================================================================
|
||||
|
||||
#include "block_workspace.h"
|
||||
|
||||
#define MAX_VARIABLES 256
|
||||
#define MAX_CALL_STACK 32
|
||||
#define MAX_EXEC_STACK 1024
|
||||
|
||||
// 变量
|
||||
typedef struct {
|
||||
char name[64];
|
||||
SlotValue value;
|
||||
int used;
|
||||
} Variable;
|
||||
|
||||
// 调用帧
|
||||
typedef struct {
|
||||
Block* block;
|
||||
Block* return_block;
|
||||
} CallFrame;
|
||||
|
||||
// 执行状态
|
||||
typedef enum {
|
||||
EXEC_IDLE = 0,
|
||||
EXEC_RUNNING,
|
||||
EXEC_WAITING,
|
||||
EXEC_PAUSED,
|
||||
EXEC_ERROR
|
||||
} ExecState;
|
||||
|
||||
// 执行器
|
||||
typedef struct BlockExecutor {
|
||||
BlockWorkspace* workspace;
|
||||
ExecState state;
|
||||
|
||||
Variable variables[MAX_VARIABLES];
|
||||
int variable_count;
|
||||
|
||||
CallFrame call_stack[MAX_CALL_STACK];
|
||||
int call_stack_top;
|
||||
|
||||
Block* current_block;
|
||||
double wait_timer;
|
||||
|
||||
int breakpoint_enabled;
|
||||
Block* breakpoint_block;
|
||||
} BlockExecutor;
|
||||
|
||||
// 初始化/销毁
|
||||
BlockExecutor* executor_create(BlockWorkspace* ws);
|
||||
void executor_destroy(BlockExecutor* exec);
|
||||
|
||||
// 控制
|
||||
void executor_start(BlockExecutor* exec);
|
||||
void executor_stop(BlockExecutor* exec);
|
||||
void executor_pause(BlockExecutor* exec);
|
||||
void executor_resume(BlockExecutor* exec);
|
||||
void executor_step(BlockExecutor* exec);
|
||||
|
||||
// 更新 (每帧调用)
|
||||
void executor_update(BlockExecutor* exec, double delta_time);
|
||||
|
||||
// 变量操作
|
||||
void executor_set_variable(BlockExecutor* exec, const char* name, SlotValue value);
|
||||
SlotValue executor_get_variable(BlockExecutor* exec, const char* name);
|
||||
void executor_create_variable(BlockExecutor* exec, const char* name);
|
||||
Reference in new issue
Block a user