22 WindowClose, WindowResize, WindowFocus, WindowLostFocus, WindowMoved,
23 AppTick, AppUpdate, AppRender,
24 KeyPressed, KeyReleased, KeyTyped,
25 MouseButtonPressed, MouseButtonReleased, MouseMoved, MouseScrolled,
26 GameControllerConnected, GameControllerDisconnected
75#define EVENT_CLASS_TYPE(type) static EventType GetStaticType() { return EventType::type; }\
76 virtual EventType GetEventType() const override { return GetStaticType(); }\
77 virtual const char* GetName() const override { return #type; }
84#define EVENT_CLASS_CATEGORY(category) virtual int GetCategoryFlags() const override { return category; }
156 bool m_Handled =
false;
170 using EventFn = std::function<bool(T&)>;
212 if (m_Event.GetEventType() == T::GetStaticType())
214 m_Event.m_Handled = func(*(T*)&m_Event);
#define KARMA_API
Defining Karma's API macro for storage class information.
Definition Core.h:41
#define BIT(x)
Macro for bit-shift operation (left)
Definition Core.h:52
EventCategory
Classification of the above events.
Definition Event.h:33
@ EventCategoryInput
Events belonging to game inputs. Input device examples include keyboard, mouse, and all that.
Definition Event.h:47
@ EventCategoryKeyboard
Events belonging to game inputs from keyboard (keyboard buttons pressing for instance)
Definition Event.h:52
@ None
Events of the unknown category.
Definition Event.h:37
@ EventCategoryMouse
Events belonging to game movement inputs from mouse.
Definition Event.h:57
@ EventCategoryApplication
Events belonging to application specific processes (resizing and movement for instance)
Definition Event.h:42
@ EventCategoryMouseButton
Events belonging to game button inputs from mouse (mouse buttons pressing for instance)
Definition Event.h:62
@ EventCategoryGameControllerDevice
Events belonging to game controller devices' input.
Definition Event.h:67
EventType
Collection of events used by the Engine.
Definition Event.h:20
bool Dispatch(EventFn< T > func)
Routine for dispatching Events.
Definition Event.h:210
EventDispatcher(Event &event)
A constructor.
Definition Event.h:179
The base class of all the events for Karma.
Definition Event.h:90
virtual EventType GetEventType() const =0
Getter for event name (type)
bool IsInCategory(EventCategory category)
Routine to see if the category of the Event is (or a part of) given category.
Definition Event.h:132
virtual std::string ToString() const
String representation of the event.
Definition Event.h:125
virtual int GetCategoryFlags() const =0
Getter for category flags (enum EventCategory)
Event * GetObjPointer()
Getter for the pointer to the object.
Definition Event.h:152
friend class EventDispatcher
An event dispatching class.
Definition Event.h:96
bool IsHandled() const
Getter for the m_Handled.
Definition Event.h:142
virtual const char * GetName() const =0
Getter for event type.