Functions for creating and controlling engine native extension libraries.
Namespace: | dmExtension |
Include: | #include <dmsdk/extension/extension.h> |
TYPES | |
---|---|
extension_callback_t | Extra extension callback typedef |
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 RegisteriOSUIApplicationDelegate(id |
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) |
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. |
void RegisteriOSUIApplicationDelegate(id
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 idvoid UnregisteriOSUIApplicationDelegate( delegate)
Deregister a previously registered iOS application delegate This function is only available on iOS.
PARAMETERS
|
delegate |
an id |
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 |
|
dmWebServer::HServer |
m_WebServer |
Only valid in debug builds, where the engine service is running. 0 otherwise. |
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 |
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 |
Callback typedef for functions passed to RegisterCallback().
Result enumeration.
dmExtension::RESULT_OK |
|
dmExtension::RESULT_INIT_ERROR |
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 |
Extra callback enumeration for RegisterCallback function.
dmExtension::CALLBACK_PRE_RENDER |
|
dmExtension::CALLBACK_POST_RENDER |
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.
|
appfinal |
app-final function. May be null.
|
init |
init function. May not be null.
|
update |
update function. May be null.
|
on_event |
event callback function. May be null.
|
final |
function. May not be null.
|
EXAMPLES
Register a new extension:DM_DECLARE_EXTENSION(MyExt, "MyExt", AppInitializeMyExt, AppFinalizeMyExt, InitializeMyExt, UpdateMyExt, OnEventMyExt, FinalizeMyExt);
Set if the platform is iPhoneOS
Set if the platform is Android
Set if the platform is Html5
Set if the platform is OSX
Set if the platform is Linux
Set if the platform is Windows (on both x86 and x86_64)