README.android
changeset 6631 47ab7ba21530
parent 6387 58f0fb54bf88
child 6646 dd32cce44d3c
     1.1 --- a/README.android	Fri Nov 02 02:22:32 2012 -0700
     1.2 +++ b/README.android	Fri Nov 02 02:37:49 2012 -0700
     1.3 @@ -39,18 +39,16 @@
     1.4  
     1.5  Instructions:
     1.6  1. Copy the android-project directory wherever you want to keep your projects and rename it to the name of your project.
     1.7 -2. Move this SDL directory into the <project>/jni directory and then copy
     1.8 -SDL_config_android.h to SDL_config.h inside the include folder
     1.9 -3. Place your application source files in the <project>/jni/src directory
    1.10 -4. Edit <project>/jni/src/Android.mk to include your source files
    1.11 -5. Run 'ndk-build' (a script provided by the NDK). This compiles the C source
    1.12 +2. Move or symlink this SDL directory into the <project>/jni directory
    1.13 +3. Edit <project>/jni/src/Android.mk to include your source files
    1.14 +4. Run 'ndk-build' (a script provided by the NDK). This compiles the C source
    1.15  
    1.16  If you want to use the Eclipse IDE, skip to the Eclipse section below.
    1.17  
    1.18 -6. Edit <project>/local.properties to point to the Android SDK directory
    1.19 -7. Run 'ant debug' in android/project. This compiles the .java and eventually 
    1.20 +5. Edit <project>/local.properties to point to the Android SDK directory
    1.21 +6. Run 'ant debug' in android/project. This compiles the .java and eventually 
    1.22  creates a .apk with the native code embedded
    1.23 -8. 'ant install' will push the apk to the device or emulator (if connected)
    1.24 +7. 'ant install' will push the apk to the device or emulator (if connected)
    1.25  
    1.26  Here's an explanation of the files in the Android project, so you can customize them:
    1.27  
    1.28 @@ -74,6 +72,58 @@
    1.29  
    1.30  
    1.31  ================================================================================
    1.32 + Customizing your application name
    1.33 +================================================================================
    1.34 +
    1.35 +To customize your application name, edit AndroidManifest.xml and replace
    1.36 +"org.libsdl.app" with an identifier for your product package.
    1.37 +
    1.38 +Then create a Java class extending SDLActivity and place it in a directory
    1.39 +under src matching your package, e.g.
    1.40 +	src/com/gamemaker/game/MyGame.java
    1.41 +
    1.42 +Here's an example of a minimal class file:
    1.43 +--- MyGame.java --------------------------
    1.44 +package com.gamemaker.game;
    1.45 +
    1.46 +import org.libsdl.app.SDLActivity; 
    1.47 +import android.os.*; 
    1.48 +
    1.49 +/* 
    1.50 + * A sample wrapper class that just calls SDLActivity 
    1.51 + */ 
    1.52 +
    1.53 +public class MyGame extends SDLActivity { 
    1.54 +    protected void onCreate(Bundle savedInstanceState) { 
    1.55 +	super.onCreate(savedInstanceState); 
    1.56 +    } 
    1.57 +   
    1.58 +    protected void onDestroy() { 
    1.59 +	super.onDestroy(); 
    1.60 +    } 
    1.61 +}
    1.62 +------------------------------------------
    1.63 +
    1.64 +Then replace "SDLActivity" in AndroidManifest.xml with the name of your
    1.65 +class, .e.g. "MyGame"
    1.66 +
    1.67 +================================================================================
    1.68 + Customizing your application icon
    1.69 +================================================================================
    1.70 +
    1.71 +Conceptually changing your icon is just replacing the icon.png files in the
    1.72 +drawable directories under the res directory.
    1.73 +
    1.74 +The easiest way to create a set of icons for your project is to remove all
    1.75 +the existing icon.png files, and then use the Eclipse IDE to create a dummy
    1.76 +project.  During the process of doing this Eclipse will prompt you to create
    1.77 +an icon. Then just copy the drawable directories it creates over to your
    1.78 +res directory.
    1.79 +
    1.80 +You may need to change the name of your icon in AndroidManifest.xml to match
    1.81 +the filename used by Eclipse.
    1.82 +
    1.83 +================================================================================
    1.84   Pause / Resume behaviour
    1.85  ================================================================================
    1.86  
    1.87 @@ -106,6 +156,16 @@
    1.88  detach it.
    1.89  
    1.90  ================================================================================
    1.91 + Using STL
    1.92 +================================================================================
    1.93 +
    1.94 +You can use STL in your project by creating an Application.mk file in the jni
    1.95 +folder and adding the following line:
    1.96 +APP_STL := stlport_static
    1.97 +
    1.98 +For more information check out CPLUSPLUS-SUPPORT.html in the NDK documentation.
    1.99 +
   1.100 +================================================================================
   1.101   Additional documentation
   1.102  ================================================================================
   1.103