20 WindowClose, WindowResize, WindowFocus, WindowLostFocus, WindowMoved,
21 AppTick, AppUpdate, AppRender,
22 KeyPressed, KeyReleased, KeyTyped,
23 MouseButtonPressed, MouseButtonReleased, MouseMoved, MouseScrolled,
24 GameControllerConnected, GameControllerDisconnected
73#define EVENT_CLASS_TYPE(type) static EventType GetStaticType() { return EventType::type; }\
74 virtual EventType GetEventType() const override { return GetStaticType(); }\
75 virtual const char* GetName() const override { return #type; }
82#define EVENT_CLASS_CATEGORY(category) virtual int GetCategoryFlags() const override { return category; }
154 bool m_Handled =
false;
168 using EventFn = std::function<bool(T&)>;
210 if (m_Event.GetEventType() == T::GetStaticType())
212 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:31
@ EventCategoryInput
Events belonging to game inputs. Input device examples include keyboard, mouse, and all that.
Definition Event.h:45
@ EventCategoryKeyboard
Events belonging to game inputs from keyboard (keyboard buttons pressing for instance).
Definition Event.h:50
@ None
Events of the unknown category.
Definition Event.h:35
@ EventCategoryMouse
Events belonging to game movement inputs from mouse.
Definition Event.h:55
@ EventCategoryApplication
Events belonging to application specific processes (resizing and movement for instance).
Definition Event.h:40
@ EventCategoryMouseButton
Events belonging to game button inputs from mouse (mouse buttons pressing for instance).
Definition Event.h:60
@ EventCategoryGameControllerDevice
Events belonging to game controller devices' input.
Definition Event.h:65
EventType
Collection of events used by the Engine.
Definition Event.h:18
bool Dispatch(EventFn< T > func)
Routine for dispatching Events.
Definition Event.h:208
EventDispatcher(Event &event)
A constructor.
Definition Event.h:177
The base class of all the events for Karma.
Definition Event.h:88
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:130
virtual std::string ToString() const
String representation of the event.
Definition Event.h:123
virtual int GetCategoryFlags() const =0
Getter for category flags (enum EventCategory).
Event * GetObjPointer()
Getter for the pointer to the object.
Definition Event.h:150
friend class EventDispatcher
An event dispatching class.
Definition Event.h:94
bool IsHandled() const
Getter for the m_Handled.
Definition Event.h:140
virtual const char * GetName() const =0
Getter for event type.