SDK Extension API documentation

<dmsdk/extension/extension.h>

Functions for creating and controlling engine native extension libraries.

FUNCTION
RegisterAndroidOnActivityResultListener()

register Android activity result callback

RegisterCallback()

Register extra extension callbacks.

RegisteriOSUIApplicationDelegate()

Register application delegate

UnregisterAndroidOnActivityResultListener()

unregister Android activity result callback

UnregisteriOSUIApplicationDelegate()

Unregister an application delegate

Functions

RegisterAndroidOnActivityResultListener()

RegisterAndroidOnActivityResultListener([type:dmExtension::OnActivityResult])

Registers an activity result callback. Multiple listeners are allowed.

PARAMETERS

[type:dmExtension::OnActivityResult]

listener


RegisterCallback()

RegisterCallback(callback_type,func)

Register extra extension callbacks.

PARAMETERS

callback_type

CallbackType Callback type enum

func

extension_callback_t Function to register as callback

RETURNS

[type:bool]

Returns true if successfully registered the function, false otherwise.


RegisteriOSUIApplicationDelegate()

RegisteriOSUIApplicationDelegate(delegate)

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

This function is only available on iOS.

PARAMETERS

delegate

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

EXAMPLES

```objective-c

// myextension_ios.mm

id g_MyApplicationDelegate;


UnregisterAndroidOnActivityResultListener()

UnregisterAndroidOnActivityResultListener([type:dmExtension::OnActivityResult])

Unregisters an activity result callback

PARAMETERS

[type:dmExtension::OnActivityResult]

listener


UnregisteriOSUIApplicationDelegate()

UnregisteriOSUIApplicationDelegate(delegate)

Deregister a previously registered iOS application delegate

This function is only available on iOS.

PARAMETERS

delegate

an id

EXAMPLES

// myextension_ios.mm
void ExtensionAppFinalizeiOS(dmExtension::AppParams* params)
{
    dmExtension::UnregisteriOSUIApplicationDelegate(g_MyApplicationDelegate);
    [g_MyApplicationDelegate release];
    g_MyApplicationDelegate = 0;
}

Macros

DM_DECLARE_EXTENSION

declare a new 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.

symbol

symbol external extension symbol description (no quotes).

name

const char* extension name. Human readable.

appinit

function(dmExtension::AppParams* app_params) app-init function. May be null.

app_params
dmExtension::AppParams* Pointer to an AppParams structure.
appfinal

function(dmExtension::AppParams* app_params) app-final function. May be null.

app_params
dmExtension::AppParams* Pointer to an AppParams structure.
init

function(dmExtension::Params* params) init function. May not be null.

params
dmExtension::Params* Pointer to a Params structure
update

function(dmExtension::Params* params) update function. May be null.

params
dmExtension::Params* Pointer to a Params structure
on_event

function(dmExtension::Params* params, const dmExtension::Event* event) event callback function. May be null.

params
dmExtension::Params* Pointer to a Params structure
event
dmExtension::Event* const Pointer to an Event structure
final

function(dmExtension::Params* params) function. May not be null.

params
dmExtension::Params* Pointer to an Params structure.

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

Set if the platform is Android


DM_PLATFORM_HTML5

Set if the platform is Html5

Set if the platform is Html5


DM_PLATFORM_IOS

Set if the platform is iPhoneOS

Set if the platform is iPhoneOS


DM_PLATFORM_LINUX

Set if the platform is Linux

Set if the platform is Linux


DM_PLATFORM_OSX

Set if the platform is OSX

Set if the platform is OSX


DM_PLATFORM_WINDOWS

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

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