QuasarEngine
Cross-platform 3D engine and editor
Loading...
Searching...
No Matches
Quasar::Event Class Referenceabstract

Base class of all events. More...

#include <quasar/events/Event.h>

Inheritance diagram for Quasar::Event:
Quasar::EventOf< EventType::GamepadAxisMoved, EventCategory::Input|EventCategory::Gamepad > Quasar::EventOf< EventType::GamepadButtonPressed, EventCategory::Input|EventCategory::Gamepad > Quasar::EventOf< EventType::GamepadButtonReleased, EventCategory::Input|EventCategory::Gamepad > Quasar::EventOf< EventType::GamepadConnected, EventCategory::Gamepad > Quasar::EventOf< EventType::GamepadDisconnected, EventCategory::Gamepad > Quasar::EventOf< EventType::KeyPressed, EventCategory::Input|EventCategory::Keyboard > Quasar::EventOf< EventType::KeyReleased, EventCategory::Input|EventCategory::Keyboard > Quasar::EventOf< EventType::KeyTyped, EventCategory::Input|EventCategory::Keyboard > Quasar::EventOf< EventType::MouseButtonPressed, EventCategory::Input|EventCategory::Mouse > Quasar::EventOf< EventType::MouseButtonReleased, EventCategory::Input|EventCategory::Mouse > Quasar::EventOf< EventType::MouseMoved, EventCategory::Input|EventCategory::Mouse > Quasar::EventOf< EventType::MouseScrolled, EventCategory::Input|EventCategory::Mouse > Quasar::EventOf< EventType::WindowClose, EventCategory::Window > Quasar::EventOf< EventType::WindowFocus, EventCategory::Window > Quasar::EventOf< EventType::WindowMinimize, EventCategory::Window > Quasar::EventOf< EventType::WindowResize, EventCategory::Window > Quasar::EventOf< Type, Categories >

Public Member Functions

virtual EventType GetType () const =0
 Returns the type of the event.
virtual EventCategory GetCategories () const =0
 Returns all the categories of the event.
virtual std::string ToString () const
 Returns a readable description of the event, for debugging.
const char * GetName () const
 Returns the name of the type of the event, for example "KeyPressed".
bool IsInCategory (EventCategory category) const
 Returns true if the event belongs to the given category.
bool IsHandled () const
 Returns true if the event was handled.
void SetHandled (bool handled)
 Marks the event as handled, or not handled.

Protected Member Functions

 Event ()=default
 Creates an event that is not handled.

Detailed Description

Base class of all events.

An event is a small value that describes something that happened, like a key press or a window resize. It is sent to the application, which can mark it as handled so that it is not processed any further.

Event classes do not derive from Event directly but from EventOf, which gives them their type and categories. An event can be written to the log as is: QUASAR_ENGINE_TRACE("{}", event).

Constructor & Destructor Documentation

◆ Event()

Quasar::Event::Event ( )
protecteddefault

Creates an event that is not handled.

The constructors and assignments are protected: only event classes can create and copy events. Copying an Event on its own would lose the data of the event class.

Member Function Documentation

◆ GetType()

◆ GetCategories()

◆ ToString()

virtual std::string Quasar::Event::ToString ( ) const
inlinevirtual

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