API
API
C
API reference (EngineEvent) — Alpha (1.14.2)

Defold Learn logo


Engineevent

Built-in event identifiers and payloads published through the generic extension event transport in ``. Custom events may use their own identifiers and payloads without central registration. Payloads and their handles are borrowed for the synchronous callback. Obtain the source engine from the callback registry using ENGINE_CONTEXT_NAME. Get the registry with ExtensionParamsGetContextRegistry, then use ContextRegistryGet and cast the result to HEngine. Use EngineGetWindow for its current window. Window payloads identify the source window directly. A window handle may be null during early startup or failure cleanup. Window notifications retain the backend focus/minimize semantics. Minimization is distinct from hide/show visibility; platform callback availability is unchanged.

Include: #include <dmsdk/engine/engine_event.h>
CONSTANTS
ENGINE_STATE_EVENT engine state notification
ENGINE_WINDOW_EVENT engine window notification
ENUMS
EngineState engine state notification kind
EngineWindowEventType window notification kind
STRUCTS
struct EngineStateEvent engine state event payload
struct EngineWindowEvent engine window event payload
MACROS
ENGINE_WINDOW_EVENT_INITIALIZER (window, type) initialize a window event
ENGINE_WINDOW_EVENT_RESIZED_INITIALIZER (window, width, height) initialize a window resize event

Structs

EngineStateEvent

TYPE

struct EngineStateEvent

Payload for ENGINE_STATE_EVENT with data_size equal to sizeof(EngineStateEvent). Obtain the source engine from the extension context registry using ENGINE_CONTEXT_NAME.

MEMBERS

EngineState m_State notification being delivered


EngineWindowEvent

TYPE

struct EngineWindowEvent

Payload for ENGINE_WINDOW_EVENT with data_size equal to sizeof(EngineWindowEvent). m_Type selects the valid union member. Only ENGINE_WINDOW_EVENT_RESIZED has event-specific data: m_Data.m_Resized contains the physical framebuffer dimensions. Do not read that member for other notification types. Resize delivery follows the existing window state updates and notifications, once per native resize callback with no initial-size replay. Window events may arrive before engine Initialize; m_Window can be null during early startup. Obtain the source engine from the extension context registry using ENGINE_CONTEXT_NAME.

MEMBERS

HWindow m_Window borrowed source window, or null if not yet available
EngineWindowEventType m_Type notification selecting the valid payload
uint32_t m_Data.m_Resized.m_Width physical framebuffer width; valid only for ENGINE_WINDOW_EVENT_RESIZED
uint32_t m_Data.m_Resized.m_Height physical framebuffer height; valid only for ENGINE_WINDOW_EVENT_RESIZED


Constants

ENGINE_STATE_EVENT

Identifier for EngineStateEvent notifications.


ENGINE_WINDOW_EVENT

Identifier for EngineWindowEvent notifications.


Enums

EngineState

Identifies the initialization or deletion notification in EngineStateEvent.

ENGINE_STATE_INITIALIZED Successful engine initialization has completed.
ENGINE_STATE_DELETE_BEGIN Engine deletion begins, before collections and systems are torn down. Also delivered after initialization failure if AppInitialize succeeded.

EngineWindowEventType

Identifies the active payload in EngineWindowEvent.

ENGINE_WINDOW_EVENT_RESIZED Resize notification. Read physical dimensions from m_Data.m_Resized.
ENGINE_WINDOW_EVENT_MINIMIZED The window was minimized; not a hide notification.
ENGINE_WINDOW_EVENT_RESTORED The window was restored from minimization; not a show notification.
ENGINE_WINDOW_EVENT_FOCUS_GAINED The window or app screen gained focus.
ENGINE_WINDOW_EVENT_FOCUS_LOST The window or app screen lost focus.

Macros

ENGINE_WINDOW_EVENT_INITIALIZER

Brace initializer for an EngineWindowEvent declaration, with zeroed event data. Each argument is evaluated once. Available with the same name in C and C++.

window borrowed source window, or null
type window notification kind

EXAMPLES

EngineWindowEvent event = ENGINE_WINDOW_EVENT_INITIALIZER(window, ENGINE_WINDOW_EVENT_FOCUS_GAINED);

ENGINE_WINDOW_EVENT_RESIZED_INITIALIZER

Brace initializer for an EngineWindowEvent declaration with type ENGINE_WINDOW_EVENT_RESIZED. Each argument is evaluated once. Available with the same name in C and C++.

window borrowed source window, or null
width physical framebuffer width
height physical framebuffer height

EXAMPLES

EngineWindowEvent event = ENGINE_WINDOW_EVENT_RESIZED_INITIALIZER(window, 800, 600);