Marmalade Concepts and Features
Can a single build of an app really target any device? How does this work?
Marmalade builds your app as a single code binary that can run on all supported platforms and devices. The machine code in this binary runs unmodified on every target device, giving you the confidence that exactly the same code is running everywhere.
The app binary is packaged with assets and a platform-dependent binary into the appropriate package format. For example, the same binary and assets will go into an IPA file for iOS and an APK for android. Icons, splash screens and other package features can be specified in the project's MKB file.
How do I handle differences between the devices, like screen resolution, etc?
The system APIs provide reflection for most device capabilities, for example an app can query the device's screen width using
s3eSurfaceGetInt(S3E_SURFACE_WIDTH). Marmalade apps use these APIs to customise themselves for the device.
For more abstract device differences the app can combine custom settings with conditional blocks in the ICF file, for example:
StoreLink= <a href="http://market.android.com/<br">http://market.android.com/<br</a> />
StoreLink=<a href="http://itunes.apple.com/<br">http://itunes.apple.com/<br</a> />
This has the advantage that further variations can be added in future (often without even recompiling the app).
The s3eDeviceInfo example is useful for identifying device information quickly. It displays basic information about the device and can be easily edited to add more properties. Note that a deployment of any app using a Debug loader will also output basic device information at the start of trace files.
How do I debug on device?
One of the main aims of Marmalade is to minimize the requirement for on-device debugging, which is slower and less unreliable even on the best platforms. A fast, flexible and accurate desktop ARM emulator is included to allow debugging of the actual code that runs on device.
Generally, a debug version of the platform loader can be deployed that will output tracing. The exact method of retrieving this file depends on the platform.
Using Marmalade Mac, a fully native iOS build can be generated in XCode and debugged/profiled with the usual Apple tools.
Can I use native platform code in my app?
Yes, the EDK (Extensions Development Kit) allows developers to call native OS APIs from within their Marmalade apps. The EDK is currently supported for iOS, Android and Windows. There is further information on using the EDK in the documentation here.
Use of native OS APIs is also supported on Android through the JNI (Java Native Interface) S3E Extension. This allows you to include Java code for Android, either directly in the C++ source files of your Marmalade app, or by building and executing standard Java source files and assets. Due to the flexible nature of the MKB system, you can use it to define a project for the native Java part of the process if you wish - i.e. it will include .java files and build them into a .jar that can be used by your C++ app.
Can I use the standard POSIX APIS such as , ?
Yes, Marmalade supports large parts of the POSIX API and also the BSD socket API via . These are implemented via the underlying S3E APIs.
Do Marmalade apps leverage hardware-accelerated floating-point processing?
Yes, it is possible to create builds which use hardware enabled floating point support via the arm-fpu ICF setting, which is to be set as an MKB option. Note that a build prepared in this way will not run on devices with no FPU.
Internally Marmalade uses 1.3.12 fixed-point in all the IwGx, IwGraphics and IwAnim pipelines (positions, normals, colours, UVs). This approach is often preferable to floating point even if an FPU is available. For example, on the iPhone GPU the use of 16-bits per component is half the bandwidth compared to 32-bits per component used by float.
Floating point matrices can be used in the transform stack. Marmalade will soon add support for floating point streams and animations.
How can I fix my app to landscape or portrait aspect ratio?
The ICF setting [s3e] FixScreenOrientation can be used to fix the screen in a given aspect ratio. "1" means portrait and "2" means landscape. The landscape setting will allow either landscape setting based on the device's orientation. In future SDK versions, this may be expanded to allow specification of all 4 orientations explicitly.
Does Marmalade support internationalisation (for example: Japanese, Chinese, Korean,... characters)?
Marmalade does not include any support for switching strings/assets by language out of the box. Most common approaches will work fine.
Displaying non-Roman fonts can be achieved by using the IwGxFont module, which supports rendering of bitmap and TTF fonts, therefore supporting virtually any character set. Bitmap fonts are created using the Marmalade Studio Font Builder.
Note: Please be careful to save any text to be imported as a UTF-8 text file. (See the documentation of your editor on how to save files in this format)
Is Marmalade just for games?
No. Marmalade’s sweet spot is 'rich' apps, by which we mean any combination of: great graphics; audio processing; use of device APIs such as camera, GPS, and microphone; deep C/C++ codebase; or anything else that raises your app above the level of a simple mobile website wrapper. Marmalade's history is in games, so is used very widely in that particular industry.