class

PointClickEngine::Core::Events::GameEvent

Inherits Reference < Object

Base class for all game events

Events are immutable data objects that carry information about something that happened in the game. They can be consumed to prevent further propagation.

Example:

class PlayerMovedEvent < GameEvent
  define_event_type "player:moved"
  getter position : RL::Vector2
  getter old_position : RL::Vector2

  def initialize(@position, @old_position)
    super()
  end
end

Constructors

Class methods

event_type

Unique event type identifier

Source

Instance methods

consume!

Mark event as consumed to stop propagation

Source
consumed?

Whether this event has been consumed (stops propagation)

Source
source

Optional source identifier (who/what raised this event)

Source
source=(source : String | Nil)

Optional source identifier (who/what raised this event)

Source
timestamp

Timestamp when the event was created

Source
type

Get the event type for this instance

Source

Macros

define_event_type(type_name)

Macro to define event type for subclasses

Source