3分間でHelloWorld
ダウンロードやライセンスの取得の時間はかかりますが、それが完了した前提でHelloWolrdをiOS Deviceで実行する方法を説明します。
ドキュメント「Creating an Application」をベースに進めています。
プロジェクトディレクトリの作成
お好みの場所にプロジェクトディレクトリ(HelloWorld)を作成します。
% mkdir HelloWorld
付随するディレクトリを作成します。
% mkdir HelloWorld/data
% mkdir HelloWorld/source
MKBファイルの作成
HelloWorld/HelloWorld.mkb
files { (source) HelloWorld.cpp } subprojects { iwgx }
ICFファイルの作成
HelloWorld/data/app.icf
[S3E] SplashscreenBkR=255 SplashscreenBkG=255 SplashscreenBkB=255 MemSize = 1000000
#### ソースファイルの作成
HelloWorld/source/HelloWorld.cpp
// Include header files for S3E (core system) and IwGx (rendering) modules #include "s3e.h" #include "IwGx.h" // Standard C-style entry point. This can take args if required. int main() { // Initialise the IwGx drawing module IwGxInit(); // Set the background colour to (opaque) blue IwGxSetColClear(0, 0, 0xff, 0xff); // Loop forever, until the user or the OS performs some action to quit the app while(!s3eDeviceCheckQuitRequest() && !(s3eKeyboardGetState(s3eKeyEsc) & S3E_KEY_STATE_DOWN) && !(s3eKeyboardGetState(s3eKeyAbsBSK) & S3E_KEY_STATE_DOWN) ) { // Clear the surface IwGxClear(); // Use the built-in font to display a string at coordinate (120, 150) IwGxPrintString(120, 150, "Hello, World!"); // Standard EGL-style flush of drawing to the surface IwGxFlush(); // Standard EGL-style flipping of double-buffers IwGxSwapBuffers(); // Sleep for 0ms to allow the OS to process events etc. s3eDeviceYield(0); } // Shut down the IwGx drawing module IwGxTerminate(); // Return return 0; }
ターゲットの確認
SchemaでDebug GCC ARMを選択していることを確認します。
Build & Run
Build & Runを押すとHelloWorldがMarmalade Simulatorで実行されます。
iOS Deviceで実行
/Developer/Marmalade/6.4/Applications/ にあるDeploy Toolを実行します。
HelloWorld/build_helloworld_xcode/deploy_config.py を選択します。
Select Build:でARM GCC Debugを選択してNextボタンを押します。
そのままNextボタンを押します。
Select Platform:でiOS(iPhone, iPad, iPod)を選択してNextボタンを押します。
そのままNextボタンを押します。
そのままNextボタンを押します。
Deploy Allボタンを押します。
完了のメッセージが出ます。この時点でiTunesにHelloWorldアプリが入っているので、iOS Deviceと同期を取ります。
iOS Deviceでの画面は次のようになっています。
HelloWorldアイコンを押すと...
debug画面が出て...
Splash Screenが出て...
HelloWorldアプリが実行されます。
最後に
Marmalade SDKの日本語ドキュメントが見当たらなかったので、駆け足ですがブログを書いてみました。
もっと深掘りしていきたいです。12月にMarmalade SDKアドベントカレンダーをやってみようかなと考えています。
25日分書ける自信がイマイチありませんが^_^;)