This page contains a Flash digital edition of a book.
BUILD | MIDDLEWARE //MARMALADE


MADEWITH MARMALADE The seven steps of Juice Marmalade offers a How To guide to bringing your Objective-C games to Android using Marmalade Juice


Marmalade Juice allows developers to convert their Objective-C iOS titles, such as Storm8’s Candy Blast Mania (above) for Android devices


MARMALADE JUICE IS the latest service added to the Marmalade SDK, enabling devs to publish iOS apps on Android by adding the ‘clang’ compiler and support for core app APIs on top of the C++SDK. This enables native iOS Objective-C titles to deploy as native code on Android with no virtual machine, so the code runs fast. So how does it actually work and what steps get you from Objective-C to Android?


1. CONVERSION PROCESS


The initial conversion process takes your original iOS Xcode project, and generates a corresponding Marmalade MKB project configured to use the Juice libraries and toolchain. This is done through the SDK Hub, so open this, choose Juice and click Starter Tutorial. Click the ‘Convert XCode’ button, which gives you an Xcode Report. Then go to the Project details page.


2. BUILD YOUR CONVERTED PROJECT Next, open the project in your IDE via the Hub. This step uses the MKB project to create a Juice Xcode project ready for building, and then launches Xcode to open it. This project exists in parallel with your original iOS project, but shares the same source files. That means you can apply updates to both your iOS and Juice versions of your app at the same time. The projects can share resource files too, but it’s common to have different


60 | JUNE 2014


versions for Juice builds, optimised to suit new platforms. Run the debug x86 build scheme for the Marmalade Simulator. Your game will now start to build and run in the Marmalade Simulator.


3. FIXING ERRORS


As this is the first pass attempt to get the core game up and running, comment out or provide stub functions for the time being to work around any errors. Return to them later to complete the conversion.


4. SIMULATOR AND DEVICE TESTING When your app builds, try running it initially in the Marmalade simulator. At this stage we’re focusing on getting the core app up and running, so skip any asserts and make necessary configuration changes. When you’re happy the core of your app is working, select the debug or release GCC ARM build schemes and build those. This will create an Android ARM build ready for deployment. Return to your project’s page in the Hub. In the ‘Deployment panel’, set the desired deployment options, connect an Android device via USB then click on the green ‘Package/Install/Run’ button. This will package your app and install it.


5.MAINTAINING IOS COMPATIBILITY As the source is shared between the iOS and Juice versions, code changes should


6. COMPLETING CONVERSION Return to any code workarounds from the initial pass and address these. Add any platform-specific features, or configure platform-specific versions of features from your iOS project, such as in-app purchases. Test and tune your build on the device to achieve the performance you intend.


7. SUBMITTING TO STORE


Once you’re happy with the Juice version, you can proceed to store submission. Follow the guides to the Google and Amazon store submissions available in the Marmalade documentation.


Marmalade Juice is free in the Marmalade SDK. Check the website for licence details and special offers. 


Why Marmalade matters: Juice enables developers to recompile legacy or live iOS apps to run natively for Android. www.madewithmarmlade.com


be conditionally compiled for the Juice build so it’s easier to switch between the two without duplicating the source. To add platform-specific functionality, create this in separate modules that you can add to just the Juice project.


Page 1  |  Page 2  |  Page 3  |  Page 4  |  Page 5  |  Page 6  |  Page 7  |  Page 8  |  Page 9  |  Page 10  |  Page 11  |  Page 12  |  Page 13  |  Page 14  |  Page 15  |  Page 16  |  Page 17  |  Page 18  |  Page 19  |  Page 20  |  Page 21  |  Page 22  |  Page 23  |  Page 24  |  Page 25  |  Page 26  |  Page 27  |  Page 28  |  Page 29  |  Page 30  |  Page 31  |  Page 32  |  Page 33  |  Page 34  |  Page 35  |  Page 36  |  Page 37  |  Page 38  |  Page 39  |  Page 40  |  Page 41  |  Page 42  |  Page 43  |  Page 44  |  Page 45  |  Page 46  |  Page 47  |  Page 48  |  Page 49  |  Page 50  |  Page 51  |  Page 52  |  Page 53  |  Page 54  |  Page 55  |  Page 56  |  Page 57  |  Page 58  |  Page 59  |  Page 60  |  Page 61  |  Page 62  |  Page 63  |  Page 64  |  Page 65  |  Page 66  |  Page 67  |  Page 68