comparison README.android @ 4967:f74a3f94c408

Added some more information on how the port works
author Sam Lantinga <slouken@libsdl.org>
date Fri, 07 Jan 2011 15:18:17 -0800
parents 91d0085b7560
children 067b6ec8b751
comparison
equal deleted inserted replaced
4966:a130bc2f0a18 4967:f74a3f94c408
8 http://developer.android.com/sdk/index.html 8 http://developer.android.com/sdk/index.html
9 9
10 Android NDK r4 or later 10 Android NDK r4 or later
11 http://developer.android.com/sdk/ndk/index.html 11 http://developer.android.com/sdk/ndk/index.html
12 12
13
13 ================================================================================ 14 ================================================================================
14 How the port works 15 How the port works
15 ================================================================================ 16 ================================================================================
16 17
17 - Android applications are Java-based, optionally with parts written in C 18 - Android applications are Java-based, optionally with parts written in C
18 - As SDL apps are C-based, we use a small Java shim that uses JNI to talk to 19 - As SDL apps are C-based, we use a small Java shim that uses JNI to talk to
19 the SDL library 20 the SDL library
20 - This means that your application C code must be placed inside an android 21 - This means that your application C code must be placed inside an android
21 Java project, along with some C support code that communicates with Java 22 Java project, along with some C support code that communicates with Java
22 - This eventually produces a standard Android .apk package 23 - This eventually produces a standard Android .apk package
24
25 The Android Java code implements an "activity" and can be found in:
26 android-project/src/org/libsdl/app/SDLActivity.java
27
28 The Java code loads your game code, the SDL shared library, and
29 dispatches to native functions implemented in the SDL library:
30 src/SDL_android.cpp
31
32 Your project must include some glue code that starts your main() routine:
33 src/main/android/SDL_android_main.cpp
23 34
24 35
25 ================================================================================ 36 ================================================================================
26 Building an app 37 Building an app
27 ================================================================================ 38 ================================================================================
46 AndroidManifest.xml - package manifest, do not modify 57 AndroidManifest.xml - package manifest, do not modify
47 build.properties - empty 58 build.properties - empty
48 build.xml - build description file, used by ant 59 build.xml - build description file, used by ant
49 default.properties - holds the ABI for the application, currently android-4 which corresponds to the Android 1.6 system image 60 default.properties - holds the ABI for the application, currently android-4 which corresponds to the Android 1.6 system image
50 local.properties - holds the SDK path, you should change this to the path to your SDK 61 local.properties - holds the SDK path, you should change this to the path to your SDK
51 jni/ - directory holding native code and Android.mk 62 jni/ - directory holding native code
52 jni/Android.mk - Android makefile that includes all subdirectories 63 jni/Android.mk - Android makefile that includes all subdirectories
53 jni/SDL/ - directory holding the SDL library files 64 jni/SDL/ - directory holding the SDL library files
54 jni/SDL/Android.mk - Android makefile for creating the SDL shared library 65 jni/SDL/Android.mk - Android makefile for creating the SDL shared library
55 jni/src/ - directory holding your application source 66 jni/src/ - directory holding your C/C++ source
56 jni/src/Android.mk - Android makefile that you should customize to include your source code and any library references 67 jni/src/Android.mk - Android makefile that you should customize to include your source code and any library references
57 res/ - directory holding resources for your application 68 res/ - directory holding resources for your application
58 res/drawable-* - directories holding icons for different phone hardware 69 res/drawable-* - directories holding icons for different phone hardware
59 res/layout/main.xml - place holder for the main screen layout, overridden by the SDL video output 70 res/layout/main.xml - place holder for the main screen layout, overridden by the SDL video output
60 res/values/strings.xml - strings used in your application, including the application name shown on the phone. 71 res/values/strings.xml - strings used in your application, including the application name shown on the phone.