Sdk extension api documentation

Functions for creating and controlling engine native extension libraries.

Namespace: dmExtension
Include: #include <dmsdk/extension/extension_gen.hpp>
TYPES
FCallback Extra extension callback typedef
FExtensionAppInitialize Callback when the app is being initialized. Called...
FExtensionCallback Extra extension callback typedef
FExtensionFinalize Calls for the finalization of an extension
FExtensionInitialize Callback when the app is being finalized
FExtensionInitialize Callback when the app is being finalized
FExtensionOnEvent Receives an event from the engine
FExtensionUpdate Updates an extension. Called for each game frame.
ENUMS
CallbackType extra callback type
EventID event id enumeration
ExtensionCallbackType extra callback type
ExtensionEventID event id enumeration
ExtensionResult result enumeration
Result result enumeration
STRUCTS
struct ExtensionParams The global parameters avalable when registering an...
struct Params The global parameters avalable when registering an...
FUNCTIONS
void ExtensionDescBufferSize() Used when registering new extensions
void ExtensionRegister(void* desc, const char* desc_size, const char* name, FExtensionAppInitialize app_initialize, FExtensionAppFinalize app_finalize, FExtensionInitialize initialize, FExtensionFinalize finalize, FExtensionUpdate update, FExtensionOnEvent on_event) Extension declaration helper. Internal function. U...
void ExtensionRegisteriOSUIApplicationDelegate(id delegate) Register application delegate
void ExtensionUnregisteriOSUIApplicationDelegate(void* delegate) Unregister an application delegate
void RegisteriOSUIApplicationDelegate(id delegate) Register application delegate
void UnregisteriOSUIApplicationDelegate(void* delegate) Unregister an application delegate
MACROS
DM_DECLARE_EXTENSION() declare a new extension
DM_PLATFORM_ANDROID() Set if the platform is Android
DM_PLATFORM_HTML5() Set if the platform is Html5
DM_PLATFORM_IOS() Set if the platform is iPhoneOS
DM_PLATFORM_LINUX() Set if the platform is Linux
DM_PLATFORM_OSX() Set if the platform is OSX
DM_PLATFORM_WINDOWS() Set if the platform is Windows (on both x86 and x86_64)

Functions

ExtensionDescBufferSize

void ExtensionDescBufferSize()

Used when registering new extensions

PARAMETERS


ExtensionRegister

void ExtensionRegister(void* desc, const char* desc_size, const char* name, FExtensionAppInitialize app_initialize, FExtensionAppFinalize app_finalize, FExtensionInitialize initialize, FExtensionFinalize finalize, FExtensionUpdate update, FExtensionOnEvent on_event)

Extension declaration helper. Internal function. Use DM_DECLARE_EXTENSION

PARAMETERS

void* desc A persistent buffer of at least 128 bytes.
const char* desc_size size of buffer holding desc. in bytes
const char* name extension name. human readble. max 16 characters long.
FExtensionAppInitialize app_initialize app-init function. May be null
FExtensionAppFinalize app_finalize app-final function. May be null
FExtensionInitialize initialize init function. May not be 0
FExtensionFinalize finalize finalize function. May not be 0
FExtensionUpdate update update function. May be null
FExtensionOnEvent on_event event callback function. May be null

ExtensionRegisteriOSUIApplicationDelegate

void ExtensionRegisteriOSUIApplicationDelegate(id delegate)

Register an iOS application delegate to the engine. Multiple delegates are supported (Max 32)

PARAMETERS

id delegate An UIApplicationDelegate, see: https://developer.apple.com/documentation/uikit/uiapplicationdelegate?language=objc

EXAMPLES

```objective-c // myextension_ios.mm id g_MyApplicationDelegate;

ExtensionUnregisteriOSUIApplicationDelegate

void ExtensionUnregisteriOSUIApplicationDelegate(void* delegate)

Deregister a previously registered iOS application delegate This function is only available on iOS.

PARAMETERS

void* delegate an id

RegisteriOSUIApplicationDelegate

void RegisteriOSUIApplicationDelegate(id delegate)

Register an iOS application delegate to the engine. Multiple delegates are supported (Max 32)

PARAMETERS

id delegate An UIApplicationDelegate, see: https://developer.apple.com/documentation/uikit/uiapplicationdelegate?language=objc

EXAMPLES

```objective-c // myextension_ios.mm id g_MyApplicationDelegate;

UnregisteriOSUIApplicationDelegate

void UnregisteriOSUIApplicationDelegate(void* delegate)

Deregister a previously registered iOS application delegate This function is only available on iOS.

PARAMETERS

void* delegate an id

Structs

ExtensionParams

TYPE

struct ExtensionParams

The global parameters avalable when registering and unregistering an extensioin

MEMBERS

HConfigFile m_ConfigFile The game project settings (including overrides and plugins)
HResourceFactory m_ResourceFactory The game resource factory / repository
lua_State* m_L The Lua state.


Params

TYPE

struct Params

The global parameters avalable when registering and unregistering an extensioin

MEMBERS

HConfigFile m_ConfigFile The game project settings (including overrides and plugins)
HResourceFactory m_ResourceFactory The game resource factory / repository
lua_State* m_L The Lua state.


Types

FCallback

Callback typedef for functions passed to RegisterCallback().


FExtensionAppInitialize

Callback when the app is being initialized. Called before FExtensionInitialize


FExtensionCallback

Callback typedef for functions passed to RegisterCallback().


FExtensionFinalize

Calls for the finalization of an extension


FExtensionInitialize

Callback when the app is being finalized


FExtensionInitialize

Callback when the app is being finalized


FExtensionOnEvent

Receives an event from the engine


FExtensionUpdate

Updates an extension. Called for each game frame.


Enums

CallbackType

Extra callback type for RegisterCallback function.

EXTENSION_CALLBACK_PRE_RENDER
EXTENSION_CALLBACK_POST_RENDER

EventID

Event id enumeration. EVENT_ID_ICONIFYAPP and EVENT_ID_DEICONIFYAPP only available on

EXTENSION_EVENT_ID_ACTIVATEAPP
EXTENSION_EVENT_ID_DEACTIVATEAPP
EXTENSION_EVENT_ID_ICONIFYAPP
EXTENSION_EVENT_ID_DEICONIFYAPP
EXTENSION_EVENT_ID_ENGINE_INITIALIZED
EXTENSION_EVENT_ID_ENGINE_DELETE

ExtensionCallbackType

Extra callback type for RegisterCallback function.

EXTENSION_CALLBACK_PRE_RENDER
EXTENSION_CALLBACK_POST_RENDER

ExtensionEventID

Event id enumeration. EVENT_ID_ICONIFYAPP and EVENT_ID_DEICONIFYAPP only available on

EXTENSION_EVENT_ID_ACTIVATEAPP
EXTENSION_EVENT_ID_DEACTIVATEAPP
EXTENSION_EVENT_ID_ICONIFYAPP
EXTENSION_EVENT_ID_DEICONIFYAPP
EXTENSION_EVENT_ID_ENGINE_INITIALIZED
EXTENSION_EVENT_ID_ENGINE_DELETE

ExtensionResult

Result enumeration.

EXTENSION_RESULT_OK
EXTENSION_RESULT_INIT_ERROR

Result

Result enumeration.

EXTENSION_RESULT_OK
EXTENSION_RESULT_INIT_ERROR

Macros

DM_DECLARE_EXTENSION

Declare and register new extension to the engine. This macro is used to declare the extension callback functions used by the engine to communicate with the extension.

EXAMPLES

Register a new extension:
DM_DECLARE_EXTENSION(MyExt, "MyExt", AppInitializeMyExt, AppFinalizeMyExt, InitializeMyExt, UpdateMyExt, OnEventMyExt, FinalizeMyExt);

DM_PLATFORM_ANDROID

Set if the platform is Android


DM_PLATFORM_HTML5

Set if the platform is Html5


DM_PLATFORM_IOS

Set if the platform is iPhoneOS


DM_PLATFORM_LINUX

Set if the platform is Linux


DM_PLATFORM_OSX

Set if the platform is OSX


DM_PLATFORM_WINDOWS

Set if the platform is Windows (on both x86 and x86_64)