author | Sam Lantinga |
Sun, 29 Aug 2010 12:00:09 -0700 | |
changeset 4867 | ba7492f9e2b8 |
parent 4727 | 8087bb208acf |
child 4954 | 144d9df7e611 |
permissions | -rw-r--r-- |
paul@4727 | 1 |
================================================================================ |
paul@4726 | 2 |
Simple DirectMedia Layer for Android |
paul@4727 | 3 |
================================================================================ |
paul@4725 | 4 |
|
paul@4725 | 5 |
Requirements: Android NDK r4 or later |
paul@4725 | 6 |
|
paul@4727 | 7 |
================================================================================ |
paul@4727 | 8 |
How the port works |
paul@4727 | 9 |
================================================================================ |
paul@4727 | 10 |
|
paul@4727 | 11 |
- Android applications are Java-based, optionally with parts written in C |
paul@4727 | 12 |
- As SDL apps are C-based, we use a small Java shim that uses JNI to talk to |
paul@4727 | 13 |
the SDL library |
paul@4727 | 14 |
- This means that your application C code must be placed inside an android |
paul@4727 | 15 |
Java project, along with some C support code that communicates with Java |
paul@4727 | 16 |
- This eventually produces a standard Android .apk package |
paul@4727 | 17 |
|
paul@4727 | 18 |
|
paul@4727 | 19 |
|
paul@4727 | 20 |
|
paul@4727 | 21 |
|
paul@4727 | 22 |
|
paul@4727 | 23 |
================================================================================ |
paul@4727 | 24 |
Building an app |
paul@4727 | 25 |
================================================================================ |
paul@4727 | 26 |
|
paul@4725 | 27 |
Instructions: |
paul@4725 | 28 |
1. Edit android/config.cfg to point to the location of the NDK |
paul@4725 | 29 |
2. Run 'make -f Makefile.android'. If all goes well, libsdl.a should be created |
paul@4727 | 30 |
3. Place your application source files in android/project/jni |
paul@4727 | 31 |
4. Edit the Android.mk to include your source files |
paul@4727 | 32 |
5. Run 'ndk-build' (a script provided by the NDK). This compiles the C source |
paul@4727 | 33 |
6. Run 'ant' in android/testproject. This compiles the .java and eventually |
paul@4725 | 34 |
creates a .apk with the C source embedded |
paul@4727 | 35 |
7. 'ant install' will push the apk to the device or emulator (if connected) |
paul@4725 | 36 |
|
paul@4725 | 37 |
|
paul@4727 | 38 |
|
paul@4727 | 39 |
|
paul@4727 | 40 |
================================================================================ |
paul@4727 | 41 |
Known issues |
paul@4727 | 42 |
================================================================================ |
paul@4727 | 43 |
|
paul@4727 | 44 |
- SDL audio (although it's mostly written, just not working properly yet) |
paul@4727 | 45 |
- TODO. I'm sure there's a bunch more stuff I haven't thought of |