libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
Loading...
Searching...
No Matches
EventTypes.h File Reference
#include <stdint.h>
#include "ship/Api.h"
Include dependency graph for EventTypes.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  IEvent
 Base event payload struct. More...
 
struct  EventMetadata
 Diagnostic metadata recorded for each unique call site that fires an event. More...
 
struct  EventListener
 Runtime record for a single event listener registration. More...
 

Macros

#define DECLARE_EVENT(eventName)   extern "C" EventID eventName##ID = -1;
 Defines and initialises (to -1) the EventID variable for an event type.
 
#define STRINGIFY_DETAIL(x)   #x
 
#define TOSTRING(x)   STRINGIFY_DETAIL(x)
 
#define FILE_AND_LINE   __FILE__ ":" TOSTRING(__LINE__)
 Produces a "file:line" string literal at the call site.
 
#define DEFINE_EVENT(eventName, ...)
 Declares a new event type and its associated EventID variable.
 
#define CALL_EVENT(eventType, ...)
 Fires an event without checking for cancellation.
 
#define CALL_CANCELLABLE_EVENT(eventType, ...)
 Fires an event and enters the following block only if the event was NOT cancelled.
 
#define CHECK_IF_NOT_CANCELLED(eventType)   if (!eventType##_.Event.Cancelled)
 Guard condition that is true when the previously fired cancellable event was NOT cancelled.
 
#define CALL_CANCELLABLE_RETURN_EVENT(eventType, ...)
 Fires an event and returns from the enclosing function if the event was cancelled.
 
#define REGISTER_EVENT(eventType)   eventType##ID = EventSystemRegisterEvent(#eventType);
 Registers an event type with the global EventSystem, populating eventName##ID.
 
#define REGISTER_LISTENER(eventType, priority, callback)    EventSystemRegisterListener(eventType##ID, callback, priority, __FILE__, __LINE__);
 Registers a listener callback for an event type with the given priority.
 
#define UNREGISTER_LISTENER(eventType, listenerID)   EventSystemUnregisterListener(eventType##ID, listenerID);
 Unregisters a listener using the ListenerID returned by REGISTER_LISTENER.
 

Typedefs

typedef int32_t EventID
 Numeric identifier for an event. -1 is uninitialized, IDs < -1 are internally registered, and IDs >= 0 are user defined.
 
typedef int64_t ListenerID
 Numeric identifier for a registered listener; used to unregister later.
 
typedef void(* EventCallback) (IEvent *)
 Callback signature for event listeners. The argument is the event payload cast to IEvent*.
 
typedef struct EventMetadata EventMetadata
 Diagnostic metadata recorded for each unique call site that fires an event.
 
typedef struct EventListener EventListener
 Runtime record for a single event listener registration.
 

Enumerations

enum  EventPriority { EVENT_PRIORITY_LOW , EVENT_PRIORITY_NORMAL , EVENT_PRIORITY_HIGH }
 Priority levels that control listener dispatch order within an event. More...
 
enum  TickEvent { TICK_EVENT_UPDATE = 0 , TICK_EVENT_LATE_UPDATE = 1 , TICK_EVENT_DRAW = 2 }
 Built-in tick phases used by Context::Tick(). More...
 

Typedef Documentation

◆ EventCallback

typedef void(* EventCallback) (IEvent *)

Callback signature for event listeners. The argument is the event payload cast to IEvent*.

◆ EventID

typedef int32_t EventID

Numeric identifier for an event. -1 is uninitialized, IDs < -1 are internally registered, and IDs >= 0 are user defined.

◆ EventListener

typedef struct EventListener EventListener

Runtime record for a single event listener registration.

◆ EventMetadata

typedef struct EventMetadata EventMetadata

Diagnostic metadata recorded for each unique call site that fires an event.

◆ ListenerID

typedef int64_t ListenerID

Numeric identifier for a registered listener; used to unregister later.

Enumeration Type Documentation

◆ EventPriority

Priority levels that control listener dispatch order within an event.

Listeners with a lower priority value are invoked before those with a higher value. Use HIGH priority for post-processing or override handlers that should run after lower-priority handlers have already processed the event.

Enumerator
EVENT_PRIORITY_LOW 

Invoked first; suitable for default or early handlers.

EVENT_PRIORITY_NORMAL 

Default priority for most listeners.

EVENT_PRIORITY_HIGH 

Invoked last; suitable for override or post-processing handlers.

◆ TickEvent

enum TickEvent

Built-in tick phases used by Context::Tick().

Enumerator
TICK_EVENT_UPDATE 
TICK_EVENT_LATE_UPDATE 
TICK_EVENT_DRAW