Sdk extension api documentation

Functions for creating and controlling engine native extension libraries.

Namespace: dmExtension
Include: #include <dmsdk/extension/extension.h>
ENUMS
dmExtension::Result result enumeration
dmExtension::EventID event id enumeration
dmExtension::CallbackType extra callback enumeration
STRUCTS
struct dmExtension::AppParams application level callback data
struct dmExtension::Params extension level callback data
struct dmExtension::Event event callback data
FUNCTIONS
bool RegisterCallback(CallbackType callback_type, extension_callback_t func) Register extra extension callbacks.
void RegisterAndroidOnActivityResultListener( [type:dmExtension::OnActivityResult]) register Android activity result callback
void UnregisterAndroidOnActivityResultListener( [type:dmExtension::OnActivityResult]) unregister Android activity result callback
void RegisteriOSUIApplicationDelegate(id delegate) Register application delegate
void UnregisteriOSUIApplicationDelegate( delegate) Unregister an application delegate
MACROS
DM_DECLARE_EXTENSION(symbol, name, appinit, appfinal, init, update, on_event, final) declare a new extension
DM_PLATFORM_IOS() Set if the platform is iPhoneOS
DM_PLATFORM_ANDROID() Set if the platform is Android
DM_PLATFORM_HTML5() Set if the platform is Html5
DM_PLATFORM_OSX() Set if the platform is OSX
DM_PLATFORM_LINUX() Set if the platform is Linux
DM_PLATFORM_WINDOWS() Set if the platform is Windows (on both x86 and x86_64)

Functions

RegisterCallback

bool RegisterCallback(CallbackType callback_type, extension_callback_t func)

Register extra extension callbacks.

PARAMETERS

CallbackType callback_type Callback type enum
extension_callback_t func Function to register as callback

RETURNS

bool Returns true if successfully registered the function, false otherwise.

RegisterAndroidOnActivityResultListener

void RegisterAndroidOnActivityResultListener( [type:dmExtension::OnActivityResult])

Registers an activity result callback. Multiple listeners are allowed.

PARAMETERS

[type:dmExtension::OnActivityResult] listener

UnregisterAndroidOnActivityResultListener

void UnregisterAndroidOnActivityResultListener( [type:dmExtension::OnActivityResult])

Unregisters an activity result callback

PARAMETERS

[type:dmExtension::OnActivityResult] listener

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( delegate)

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

PARAMETERS

delegate an id

Structs

dmExtension::AppParams

TYPE

struct dmExtension::AppParams

Extension application entry callback data. This is the data structure passed as parameter by extension Application entry callbacks (AppInit and AppFinalize) functions

MEMBERS

dmConfigFile::HConfig m_ConfigFile


dmExtension::Params

TYPE

struct dmExtension::Params

Extension callback data. This is the data structure passed as parameter by extension callbacks (Init, Finalize, Update, OnEvent)

MEMBERS

dmConfigFile::HConfig m_ConfigFile
lua_State* m_L


dmExtension::Event

TYPE

struct dmExtension::Event

Extension event callback data. This is the data structure passed as parameter by extension event callbacks (OnEvent)

MEMBERS

dmExtension::EventID m_Event


Enums

dmExtension::Result

result enumeration

Result enumeration.

dmExtension::RESULT_OK
dmExtension::RESULT_INIT_ERROR

dmExtension::EventID

event id enumeration

Event id enumeration. EVENT_ID_ICONIFYAPP and EVENT_ID_DEICONIFYAPP only available on

dmExtension::EVENT_ID_ACTIVATEAPP
dmExtension::EVENT_ID_DEACTIVATEAPP
dmExtension::EVENT_ID_ICONIFYAPP
dmExtension::EVENT_ID_DEICONIFYAPP

dmExtension::CallbackType

extra callback enumeration

Extra callback enumeration for RegisterCallback function.

dmExtension::CALLBACK_PRE_RENDER
dmExtension::CALLBACK_POST_RENDER

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 external extension symbol description (no quotes).
name extension name. Human readable.
appinit app-init function. May be null.
app_params
dmExtension::AppParams* Pointer to an AppParams structure.
appfinal app-final function. May be null.
app_params
dmExtension::AppParams* Pointer to an AppParams structure.
init init function. May not be null.
params
dmExtension::Params* Pointer to a Params structure
update update function. May be null.
params
dmExtension::Params* Pointer to a Params structure
on_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. 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_IOS

Set if the platform is iPhoneOS

Set if the platform is iPhoneOS


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_OSX

Set if the platform is OSX

Set if the platform is OSX


DM_PLATFORM_LINUX

Set if the platform is Linux

Set if the platform is Linux


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)