Game Development Reference
In-Depth Information
Time for action - running the game in
Android
Time to deploy the game to Android.
1. Follow the instructions from the HelloWorld example to import the game into
Eclipse.
2. Navigate to the proj.android folder and open the AndroidManifest.xml
file in a text editor. Then, go to the jni folder and open the Android.mk file in
a text editor.
3. In the AndroidManifest.xml file, edit the following line in the activity
tag:
android:screenOrientation="portrait"
4. And it's possible to target only tablets by adding these lines in the supports-
screens tag:
<supports-screens android:anyDensity="true"
android:smallScreens="false"
android:normalScreens="false"
android:largeScreens="true"
android:xlargeScreens="true"/>
5. Although if you want to target only tablets, you might also wish to target the later
versions of SDK, like this:
<uses-sdk android:minSdkVersion="11"/>
6. Next, let's edit the make file, so open the Android.mk file and edit the lines in
LOCAL_SRC_FILES to read:
LOCAL_SRC_FILES := hellocpp/main.cpp \
../../Classes/AppDelegate.cpp \
../../Classes/GameSprite.cpp \
../../Classes/GameLayer.cpp
7. Save it and run your application (don't forget to connect an Android device, in this
case, a tablet if you used the settings as explained here).
Search WWH ::




Custom Search