CoriEngine
Loading...
Searching...
No Matches
Cori::Core::Event Class Referenceabstract

An abstract class that is ment to be used as a template for defining events. More...

#include <Event.hpp>

Inheritance diagram for Cori::Core::Event:

Public Member Functions

virtual ~Event ()=default
virtual constexpr std::type_index GetEventType () const =0
 Gives the return type of the Event.
virtual const char * GetName () const =0
 This will give you the string version of EventType.
virtual uint32_t GetCategoryFlags () const =0
 Gives the flags of particular Event.
virtual std::string ToString () const
 Returns the name of the Event.
bool IsInCategory (const EventCategory category) const
 Checks if the Event is in specific category.

Public Attributes

bool m_Handled = false

Friends

class EventDispatcher

Detailed Description

An abstract class that is ment to be used as a template for defining events.

Definition at line 18 of file Event.hpp.

Constructor & Destructor Documentation

◆ ~Event()

virtual Cori::Core::Event::~Event ( )
virtualdefault

Member Function Documentation

◆ GetCategoryFlags()

virtual uint32_t Cori::Core::Event::GetCategoryFlags ( ) const
nodiscardpure virtual

Gives the flags of particular Event.

Note
You shouldn't overload this, it is overloaded by EVENT_CLASS_CATEGORY macro!
Returns
Flag variable that stores all the relevant EventCategory flags.

Implemented in Cori::Core::KeyEvent, Cori::Core::MouseButtonEvent, Cori::Core::MouseMovedEvent, Cori::Core::MouseScrolledEvent, Cori::Core::WindowCloseEvent, and Cori::Core::WindowResizeEvent.

◆ GetEventType()

virtual constexpr std::type_index Cori::Core::Event::GetEventType ( ) const
nodiscardconstexprpure virtual

Gives the return type of the Event.

Note
You shouldn't overload this, it is overloaded by EVENT_CLASS_TYPE macro!
Returns
Type index of derived event type.

Implemented in Cori::Core::KeyPressedEvent, Cori::Core::KeyReleasedEvent, Cori::Core::MouseButtonPressedEvent, Cori::Core::MouseButtonReleasedEvent, Cori::Core::MouseMovedEvent, Cori::Core::MouseScrolledEvent, Cori::Core::WindowCloseEvent, and Cori::Core::WindowResizeEvent.

◆ GetName()

virtual const char * Cori::Core::Event::GetName ( ) const
nodiscardpure virtual

This will give you the string version of EventType.

Note
You shouldn't overload this, it is overloaded by EVENT_CLASS_TYPE macro!
Returns
EventType name.

Implemented in Cori::Core::KeyPressedEvent, Cori::Core::KeyReleasedEvent, Cori::Core::MouseButtonPressedEvent, Cori::Core::MouseButtonReleasedEvent, Cori::Core::MouseMovedEvent, Cori::Core::MouseScrolledEvent, Cori::Core::WindowCloseEvent, and Cori::Core::WindowResizeEvent.

◆ IsInCategory()

bool Cori::Core::Event::IsInCategory ( const EventCategory category) const
inlinenodiscard

Checks if the Event is in specific category.

Parameters
categoryBitmask that we need to check presence of.
Returns
True is present, false otherwise.

Definition at line 59 of file Event.hpp.

Here is the call graph for this function:

◆ ToString()

virtual std::string Cori::Core::Event::ToString ( ) const
inlinenodiscardvirtual

Returns the name of the Event.

Note
This is up to the user to overload, by default return the same thing GetName() does.
Returns
Event name.

Reimplemented in Cori::Core::KeyPressedEvent, Cori::Core::KeyReleasedEvent, Cori::Core::MouseButtonPressedEvent, Cori::Core::MouseButtonReleasedEvent, Cori::Core::MouseMovedEvent, Cori::Core::MouseScrolledEvent, Cori::Core::WindowCloseEvent, and Cori::Core::WindowResizeEvent.

Definition at line 51 of file Event.hpp.

Here is the call graph for this function:

◆ EventDispatcher

friend class EventDispatcher
friend

Definition at line 19 of file Event.hpp.

Member Data Documentation

◆ m_Handled

bool Cori::Core::Event::m_Handled = false

Definition at line 63 of file Event.hpp.


The documentation for this class was generated from the following file: