重新命名EventDispatcher

This commit is contained in:
2025-07-17 02:25:42 +08:00
parent ea52f06e72
commit 5c4851e586

View File

@@ -17,7 +17,7 @@ namespace hgl
#define PROP_DPIISOLATION L"PROP_ISOLATION" #define PROP_DPIISOLATION L"PROP_ISOLATION"
static KeyboardButton KeyConvert[256]{}; static KeyboardButton KeyConvert[256]{};
static void (*WMProc[2048])(EventDispatch *,uint32,uint32){}; //消息处理队列 static void (*WMProc[2048])(EventDispatcher *,uint32,uint32){}; //消息处理队列
void InitKeyConvert() void InitKeyConvert()
{ {
@@ -180,7 +180,7 @@ namespace hgl
static EventHeader event_header; static EventHeader event_header;
static WindowEventData window_event_data; static WindowEventData window_event_data;
void WMProcDestroy(EventDispatch *ie,uint32,uint32) void WMProcDestroy(EventDispatcher *ie,uint32,uint32)
{ {
event_header.type =InputEventSource::Window; event_header.type =InputEventSource::Window;
event_header.index =0; event_header.index =0;
@@ -192,7 +192,7 @@ namespace hgl
static MouseEventData mouse_event_data; static MouseEventData mouse_event_data;
#define WMEF_MOUSE(mouse_button,action) void WMProcMouse##mouse_button##action(EventDispatch *ie,uint32 wParam,uint32 lParam) \ #define WMEF_MOUSE(mouse_button,action) void WMProcMouse##mouse_button##action(EventDispatcher *ie,uint32 wParam,uint32 lParam) \
{ \ { \
mouse_event_data.x=LOWORD(lParam); \ mouse_event_data.x=LOWORD(lParam); \
mouse_event_data.y=HIWORD(lParam); \ mouse_event_data.y=HIWORD(lParam); \
@@ -217,7 +217,7 @@ namespace hgl
WMEF_MOUSE(Right,Released); WMEF_MOUSE(Right,Released);
WMEF_MOUSE(Right,DblClicked); WMEF_MOUSE(Right,DblClicked);
void WMProcMouseMove(EventDispatch *ie,uint32 wParam,uint32 lParam) void WMProcMouseMove(EventDispatcher *ie,uint32 wParam,uint32 lParam)
{ {
mouse_event_data.x=LOWORD(lParam); mouse_event_data.x=LOWORD(lParam);
mouse_event_data.y=HIWORD(lParam); mouse_event_data.y=HIWORD(lParam);
@@ -231,7 +231,7 @@ namespace hgl
} }
#undef WMEF_MOUSE #undef WMEF_MOUSE
#define WMEF2(name) void name(EventDispatch *ie,uint32 wParam,uint32 lParam) #define WMEF2(name) void name(EventDispatcher *ie,uint32 wParam,uint32 lParam)
WMEF2(WMProcMouseWheel) WMEF2(WMProcMouseWheel)
{ {
const int zDelta=GET_WHEEL_DELTA_WPARAM(wParam); const int zDelta=GET_WHEEL_DELTA_WPARAM(wParam);
@@ -279,7 +279,7 @@ namespace hgl
static KeyboardEventData keyboard_event_data; static KeyboardEventData keyboard_event_data;
#define WMEF1(name) void name(EventDispatch *ie,uint32 wParam,uint32) #define WMEF1(name) void name(EventDispatcher *ie,uint32 wParam,uint32)
WMEF1(WMProcKeyDown) WMEF1(WMProcKeyDown)
{ {
event_header.type =InputEventSource::Keyboard; event_header.type =InputEventSource::Keyboard;
@@ -368,7 +368,7 @@ namespace hgl
if(uMsg<2048) if(uMsg<2048)
if(WMProc[uMsg]) if(WMProc[uMsg])
{ {
EventDispatch *ie=(EventDispatch *)GetWindowLongPtrW(hWnd,GWLP_USERDATA); EventDispatcher *ie=(EventDispatcher *)GetWindowLongPtrW(hWnd,GWLP_USERDATA);
if(ie) if(ie)
WMProc[uMsg](ie,wParam,lParam); WMProc[uMsg](ie,wParam,lParam);