Skip to content
Danilo Todorović edited this page Mar 31, 2024 · 3 revisions

Basic overview of the event system in Blazr


Different types of events

Events in Blazr are separated into 3 different types. All these events are derived from the base class Event which is an abstract class and can not be instantiated. The class provides 5 different functions which all the derivative events should implement. This also enables users to create their own events if they so desire. The functions provided are:

  virtual EventType getEventType() const = 0;
  virtual int getCategoryFlags() const = 0;
  inline bool isInCategory(EventCategory category) {
    return getCategoryFlags() & category;
  }

  // Only for debugging
  virtual std::string toString() const { return getName(); }
  virtual const char *getName() const = 0;

The different event types are:


Application Events

Events of this type are related to the application behavior. Currently implemented:

  • WindowResizeEvent
  • WindowCloseEvent
  • AppTickEvent
  • AppUpdateEvent
  • AppRenderEvent

Key Events

Events of this type are used to create events when a keyboard button has been pressed or released. The provided events are:

  • KeyPressedEvent
  • KeyReleasedEvent

For different key codes, please refer to: Key Codes

Mouse Events

Events of this type are used to create events for mouse actions, such as a mouse button being pressed, released, the mouse being moved, as well as scrolling. The events provided are:

  • MouseButtonPressedEvent
  • MouseButtonReleasedEvent
  • MouseMovedEvent
  • MouseScrolledEvnt

For different mouse button codes, please refer to: Mouse Codes

Clone this wiki locally