Layout codes of InputEvent/WindowEvent

This commit is contained in:
hyzboy 2025-03-06 01:20:37 +08:00
parent 3f5baa99d0
commit b78d31d8a0
3 changed files with 93 additions and 103 deletions

View File

@ -1,12 +1,9 @@
#ifndef HGL_IO_INPUT_EVENT_INCLUDE #pragma once
#define HGL_IO_INPUT_EVENT_INCLUDE
#include<hgl/type/SortedSet.h> #include<hgl/type/SortedSet.h>
#include<hgl/io/event/InputEventSource.h> #include<hgl/io/event/InputEventSource.h>
namespace hgl namespace hgl::io
{ {
namespace io
{
struct EventHeader struct EventHeader
{ {
uint8 type; ///<输入源类型 uint8 type; ///<输入源类型
@ -99,6 +96,4 @@ namespace hgl
return sub_event_proc[size_t(ies)].Delete(ie); return sub_event_proc[size_t(ies)].Delete(ie);
} }
};//class InputEvent };//class InputEvent
}//namespace io }//namespace hgl::io
}//namespace hgl
#endif//HGL_IO_INPUT_EVENT_INCLUDE

View File

@ -1,11 +1,8 @@
#ifndef HGL_IO_INPUT_DEVICE_SOURCE_INCLUDE #pragma once
#define HGL_IO_INPUT_DEVICE_SOURCE_INCLUDE
#include<hgl/TypeFunc.h> #include<hgl/TypeFunc.h>
namespace hgl namespace hgl::io
{ {
namespace io
{
enum class InputEventSource enum class InputEventSource
{ {
Root=0, Root=0,
@ -19,6 +16,4 @@ namespace hgl
ENUM_CLASS_RANGE(Root,Joystick) ENUM_CLASS_RANGE(Root,Joystick)
}; };
}//namespace io }//namespace hgl::io
}//namespace hgl
#endif//HGL_IO_INPUT_DEVICE_SOURCE_INCLUDE

View File

@ -36,7 +36,7 @@ namespace hgl
WindowEvent():InputEvent(InputEventSource::Window){} WindowEvent():InputEvent(InputEventSource::Window){}
virtual ~WindowEvent()=default; virtual ~WindowEvent()=default;
EventProcResult OnEvent(const EventHeader &header,const uint64 data) override virtual EventProcResult OnEvent(const EventHeader &header,const uint64 data) override
{ {
wed=(WindowEventData *)&data; wed=(WindowEventData *)&data;