10 WindowClose, WindowResize, WindowFocus, WindowLostFocus, WindowMoved,
11 AppTick, AppUpdate, AppRender,
12 KeyPressed, KeyReleased, KeyTyped,
13 MouseButtonPressed, MouseButtonReleased, MouseMoved, MouseScrolled,
14 GameControllerConnected, GameControllerDisconnected
20 EventCategoryApplication = BIT(0),
21 EventCategoryInput = BIT(1),
22 EventCategoryKeyboard = BIT(2),
23 EventCategoryMouse = BIT(3),
24 EventCategoryMouseButton = BIT(4),
25 EventCategoryGameControllerDevice = BIT(5)
28#define EVENT_CLASS_TYPE(type) static EventType GetStaticType() { return EventType::type; }\
29 virtual EventType GetEventType() const override { return GetStaticType(); }\
30 virtual const char* GetName() const override { return #type; }
32#define EVENT_CLASS_CATEGORY(category) virtual int GetCategoryFlags() const override { return category; }
38 virtual EventType GetEventType()
const = 0;
39 virtual const char* GetName()
const = 0;
40 virtual int GetCategoryFlags()
const = 0;
41 virtual std::string ToString()
const {
return GetName(); }
43 inline bool IsInCategory(EventCategory category)
45 return GetCategoryFlags() & category;
48 inline bool IsHandled()
const
53 inline Event* GetObjPointer() {
return this; }
57 bool m_Handled =
false;
63 using EventFn = std::function<bool(T&)>;
70 bool Dispatch(EventFn<T> func)
72 if (m_Event.GetEventType() == T::GetStaticType())
74 m_Event.m_Handled = func(*(T*)&m_Event);
@ None
Definition KarmaTypes.h:33