<dmsdk/extension/extension.h>
Functions for creating and controlling engine native extension libraries.
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
AppParams
structure.appfinal -
function(dmExtension::AppParams* app_params) app-final function. May be null.
app_params
AppParams
structure.init -
function(dmExtension::Params* params) init function. May not be null.
params
Params
structureupdate -
function(dmExtension::Params* params) update function. May be null.
params
Params
structureon_event -
function(dmExtension::Params* params, const dmExtension::Event* event) event callback function. May be null.
params
Params
structureevent
Event
structurefinal -
function(dmExtension::Params* params) function. May not be null.
params
Params
structure.Register a new extension:
DM_DECLARE_EXTENSION(MyExt, "MyExt", AppInitializeMyExt, AppFinalizeMyExt, InitializeMyExt, UpdateMyExt, OnEventMyExt, FinalizeMyExt);
Set if the platform is Android
Set if the platform is Android
Set if the platform is Html5
Set if the platform is Html5
Set if the platform is iPhoneOS
Set if the platform is iPhoneOS
Set if the platform is Linux
Set if the platform is Linux
Set if the platform is OSX
Set if the platform is OSX
Set if the platform is Windows (on both x86 and x86_64)
Set if the platform is Windows (on both x86 and x86_64)
OnActivityResult callback typedef
Activity result callback function type. Monitors events from the main activity. Used with RegisterOnActivityResultListener() and UnregisterOnActivityResultListener()
env -
void*
activity -
void*
request_code -
int32_t
result_code -
int32_t
result -
void*
register Android activity result callback
Registers an activity result callback. Multiple listeners are allowed.
[type:dmExtension::OnActivityResult] -
listener
Register application delegate
Register an iOS application delegate to the engine. Multiple delegates are supported (Max 32)
This function is only available on iOS.
delegate -
id<UIApplicationDelegate> An UIApplicationDelegate, see: https://developer.apple.com/documentation/uikit/uiapplicationdelegate?language=objc
```objective-c
// myextension_ios.mm
id
unregister Android activity result callback
Unregisters an activity result callback
[type:dmExtension::OnActivityResult] -
listener
Unregister an application delegate
Deregister a previously registered iOS application delegate
This function is only available on iOS.
delegate -
an id
// myextension_ios.mm void ExtensionAppFinalizeiOS(dmExtension::AppParams* params) { dmExtension::UnregisteriOSUIApplicationDelegate(g_MyApplicationDelegate); [g_MyApplicationDelegate release]; g_MyApplicationDelegate = 0; }
application level callback data
Extension application entry callback data. This is the data structure passed as parameter by extension Application entry callbacks (AppInit and AppFinalize) functions
m_ConfigFile -
dmConfigFile::HConfig
event callback data
Extension event callback data. This is the data structure passed as parameter by extension event callbacks (OnEvent)
m_Event -
dmExtension::EventID
event id enumeration
Event id enumeration.
dmExtension::EVENT_ID_ACTIVATEAPP -
dmExtension::EVENT_ID_DEACTIVATEAPP -
extension level callback data
Extension callback data. This is the data structure passed as parameter by extension callbacks (Init, Finalize, Update, OnEvent)
m_ConfigFile -
dmConfigFile::HConfig
m_L -
lua_State*
result enumeration
Result enumeration.
dmExtension::RESULT_OK -
dmExtension::RESULT_INIT_ERROR -