Raven Engine v0.1
A modern 3D Game Engine
Loading...
Searching...
No Matches
Event.h File Reference

Defines the base Event structure, event types, and dispatching utilities for Raven. More...

Classes

struct  Raven::Event
 Base event data container. More...
struct  Raven::EventSlot
 Fixed-size container for a single event. More...

Namespaces

namespace  Raven

Enumerations

enum class  Raven::EventType : u8 {
  Raven::None = 0 , Raven::WindowResize , Raven::WindowClose , Raven::KeyPressed ,
  Raven::KeyReleased , Raven::MouseMoved , Raven::MouseScrolled , Raven::MouseButtonPressed ,
  Raven::MouseButtonReleased
}
 Enumerates all distinct event types recognized by the engine. More...
enum  Raven::EventCategory : u8 {
  Raven::None = 0 , Raven::EventCategoryApplication = 1 << 0 , Raven::EventCategoryInput = 1 << 1 , Raven::EventCategoryKeyboard = 1 << 2 ,
  Raven::EventCategoryMouse = 1 << 3 , Raven::EventCategoryMouseButton = 1 << 4
}
 Bitmaskable flags that group related event types. More...

Functions

template<typename EventT, typename Func>
constexpr bool Raven::Dispatch (EventSlot &slot, Func &&func) noexcept
 Type-safe dispatcher for event instances.
Bitwise operators for EventCategory
constexpr EventCategory Raven::operator| (EventCategory lhs, EventCategory rhs) noexcept
 Binary OR for combining event categories.
constexpr EventCategory Raven::operator& (EventCategory lhs, EventCategory rhs) noexcept
 Binary AND for intersecting event categories.
constexpr EventCategory Raven::operator^ (EventCategory lhs, EventCategory rhs) noexcept
 Binary XOR for toggling event category bits.
constexpr EventCategory Raven::operator~ (EventCategory rhs) noexcept
 Bitwise NOT for inverting all bits.
constexpr EventCategoryRaven::operator|= (EventCategory &lhs, EventCategory rhs) noexcept
 OR assignment for combining event categories in-place.
constexpr EventCategoryRaven::operator&= (EventCategory &lhs, EventCategory rhs) noexcept
 AND assignment for masking event categories in-place.
constexpr EventCategoryRaven::operator^= (EventCategory &lhs, EventCategory rhs) noexcept
 XOR assignment for toggling bits in-place.

Variables

constexpr usize Raven::MaxEventPayloadSize = 16
 Maximum payload size of an event in bytes.

Detailed Description

Defines the base Event structure, event types, and dispatching utilities for Raven.

Author
PhilikusHD

The Event system provides a minimal, type-safe, and cache-friendly mechanism for communication between engine subsystems. Events are simple data structs tagged with an EventType and EventCategory bitmask for quick categorization and filtering.

Dispatching is done via a templated function that matches types using compile-time StaticType() identifiers, eliminating the need for virtual dispatch.