Using the Gyroscope extension

We've now seen how to create and build extension modules for Windows, Android, and iOS, but how do we make use of them in our Marmalade projects?

It's actually surprisingly easy. All we have to do is reference our extension in the project MKB file's subprojects section (the easiest way to do this is to provide a relative path to the Gyroscope directory from the main project directory), just as we would with any normal code module, and then include the auto-generated Gyroscope.h header file so we can call the extension functions.

The only thing to bear in mind is that because an extension may not have been created for every platform we wish to target, we must make sure the extension is available for use before we call any of its functions. This is easily done by using the GyroscopeAvailable function that is automatically generated for us by the EDK build scripts. If this function returns S3E_TRUE, the extension is available for use. If it returns S3E_FALSE, any call to an extension function will fire an assert but will otherwise do nothing.

There are also no special steps required for building or deploying our application, even on Android, where any code written in Java needs to be supplied in a JAR file. The deployment tool will automatically add any required extension files to the install package without us having to do a thing.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.71.106