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 dmExtension::ParamsGetContextRegistry, then use ContextRegistryGet and cast the result to HEngine. Use dmEngine::GetWindow 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.

Namespace: dmEngine
Include: #include <dmsdk/engine/engine_event_gen.hpp>
CONSTANTS
ENGINE_EVENT_INPUT_ACTIONS input actions have been resolved
ENGINE_STATE_EVENT engine state notification
ENGINE_WINDOW_EVENT engine window notification
EVENT_INPUT_ACTIONS input actions have been resolved
EVENT_STATE engine state notification
EVENT_WINDOW engine window notification
ENUMS
EngineState engine state notification kind
EngineWindowEventType window notification kind
State engine state notification kind
WindowEventType window notification kind
STRUCTS
struct EngineInputActionsEvent resolved input actions
struct EngineStateEvent engine state event payload
struct EngineWindowEvent engine window event payload
struct InputActionsEvent resolved input actions
struct StateEvent engine state event payload
struct WindowEvent engine window event payload
MACROS
ENGINE_WINDOW_EVENT_INITIALIZER () initialize a window event
ENGINE_WINDOW_EVENT_RESIZED_INITIALIZER () initialize a window resize event

Structs

EngineInputActionsEvent

TYPE

struct EngineInputActionsEvent

Published once per completed input update after application bindings are resolved, coordinates converted and text/marked-text ordered last, before focused game-object dispatch. Empty updates are published; skipped input updates are not. This is independent of extension Update and rendered-frame count. Input events use the generic handler's application lifetime. Iterate the current resolved batch through InputIterateActions and the iterator getters. The batch belongs to input and remains valid until the next binding update starts or the context is destroyed. Iteration cannot consume input or change focused dispatch. Obtain the source engine from the extension context registry using ENGINE_CONTEXT_NAME. Focused gameplay should use native component input/update callbacks.

MEMBERS

HInputContext m_Input valid borrowed input context, including empty updates


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


InputActionsEvent

TYPE

struct InputActionsEvent

Published once per completed input update after application bindings are resolved, coordinates converted and text/marked-text ordered last, before focused game-object dispatch. Empty updates are published; skipped input updates are not. This is independent of extension Update and rendered-frame count. Input events use the generic handler's application lifetime. Iterate the current resolved batch through dmInput::IterateActions and the iterator getters. The batch belongs to input and remains valid until the next binding update starts or the context is destroyed. Iteration cannot consume input or change focused dispatch. Obtain the source engine from the extension context registry using ENGINE_CONTEXT_NAME. Focused gameplay should use native component input/update callbacks.

MEMBERS

dmInput::HContext m_Input valid borrowed input context, including empty updates


StateEvent

TYPE

struct StateEvent

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

MEMBERS

State m_State notification being delivered


WindowEvent

TYPE

struct WindowEvent

Payload for EVENT_WINDOW with data_size equal to sizeof(WindowEvent). m_Type selects the valid union member. Only 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
WindowEventType m_Type notification selecting the valid payload
uint32_t m_Data.m_Resized.m_Width physical framebuffer width; valid only for WINDOW_EVENT_RESIZED
uint32_t m_Data.m_Resized.m_Height physical framebuffer height; valid only for WINDOW_EVENT_RESIZED


Constants

ENGINE_EVENT_INPUT_ACTIONS

Event identifier for EngineInputActionsEvent notifications.


ENGINE_STATE_EVENT

Identifier for EngineStateEvent notifications.


ENGINE_WINDOW_EVENT

Identifier for EngineWindowEvent notifications.


EVENT_INPUT_ACTIONS

Event identifier for InputActionsEvent notifications.


EVENT_STATE

Identifier for StateEvent notifications.


EVENT_WINDOW

Identifier for WindowEvent 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.

State

Identifies the initialization or deletion notification in StateEvent.

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

WindowEventType

Identifies the active payload in WindowEvent.

WINDOW_EVENT_RESIZED Resize notification. Read physical dimensions from m_Data.m_Resized.
WINDOW_EVENT_MINIMIZED The window was minimized; not a hide notification.
WINDOW_EVENT_RESTORED The window was restored from minimization; not a show notification.
WINDOW_EVENT_FOCUS_GAINED The window or app screen gained focus.
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++.

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++.

EXAMPLES

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

⌂ 换网址