核心热路径(数学/内存/字符串/性能分析)用MASM汇编(SSE/AVX2) 外围系统(窗口/渲染/ECS/音频/UI/脚本)用C语言 含自研编辑器、VisualScript积木编程、中文渲染(glyph_atlas)
45 lines
1.4 KiB
C
45 lines
1.4 KiB
C
#pragma once
|
|
|
|
// ============================================================================
|
|
// block_interaction.h - 交互系统
|
|
// ============================================================================
|
|
|
|
#include "block_workspace.h"
|
|
|
|
typedef struct {
|
|
int mouse_x, mouse_y;
|
|
int mouse_down;
|
|
int mouse_button; // 0=left, 1=right, 2=middle
|
|
int key;
|
|
int key_pressed;
|
|
|
|
// 拖拽状态
|
|
Block* dragging_block;
|
|
float drag_offset_x, drag_offset_y;
|
|
|
|
// 连接状态
|
|
BlockSlot* connecting_from;
|
|
float connect_start_x, connect_start_y;
|
|
|
|
// 选择状态
|
|
Block* selected_block;
|
|
|
|
// 平移状态
|
|
int panning;
|
|
float pan_start_x, pan_start_y;
|
|
float view_start_x, view_start_y;
|
|
} BlockInteraction;
|
|
|
|
// 初始化
|
|
void interaction_init(BlockInteraction* inter);
|
|
|
|
// 处理输入事件
|
|
void interaction_mouse_move(BlockInteraction* inter, BlockWorkspace* ws, int x, int y);
|
|
void interaction_mouse_down(BlockInteraction* inter, BlockWorkspace* ws, int button);
|
|
void interaction_mouse_up(BlockInteraction* inter, BlockWorkspace* ws, int button);
|
|
void interaction_key_down(BlockInteraction* inter, BlockWorkspace* ws, int key);
|
|
void interaction_mouse_wheel(BlockInteraction* inter, BlockWorkspace* ws, int delta);
|
|
|
|
// 更新 (每帧调用)
|
|
void interaction_update(BlockInteraction* inter, BlockWorkspace* ws);
|