Table of Contents

Android Manual Setup

This tutorial demonstrates how to build a new Android project with Orx. It should work for all Android 2.0+ devices, though there may still be some issues with the emulators.

(Tutorial originally and primarily written by laschweinski, revised and edited by newton64.)

1. Download and configure the Android development environment

2. Create and configure an Android project

<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
  <activity android:name="..AnTapCountActivity" android:label="@string/app_name" android:screenOrientation="portrait"
            android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
    <intent-filter>
      <action android:name="android.intent.action.MAIN" />
      <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
  </activity>
</application>
<uses-sdk android:minSdkVersion="4" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
      
      

3. Add required sources and assets to the project

OR

FORMERLY INCLUDED, BUT PROBABLY DEPRECATED: b. copy and paste the headers and lib of orx from the orx release folder to your project, the path of it could be defined by yourself, but you should modify the Android.mk as what I describe at the next section. note that you could also link to the lib in the orx release folder. in this case, no any move need to be applied. But some configuration has to set, same as the next section illustrate.

4. Edit the Makefile and compile and build the program

	#the name of the lib
	ORX_MODULE_NAME := orxTapAndCount
	#set all of sources
	ORXAPP_SRCS := *.c *.cpp
		   
	ORXLIB     := extern/lib/android
	ORXINCLUDE := extern/include
	BOX2DLIB     := extern/Box2D_2.1.3/lib/android
	BOX2DORXINCLUDE := extern/Box2D_2.1.3/include
              SOILLIB         := extern/SOIL/lib/android

protected void onCreate(Bundle savedInstanceState) {
	isDebug = false;
	//when you need to run in the emulator it should set to true
	usingGLES1 = false;
	appPath = "bounce_demo";
	appName = "orxTest";
	orxAppLibName = "orxTapAndCount";
	// load the .so lib in AnOrxActivity
	super.onCreate(savedInstanceState);
	// So we can call stuff from static callbacks
	// TODO keep the screen on, I know it is not a perfect decision,
	// acticity should resume from pausing.
	getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
			WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
	//build the gl surface, start to init and run the loop
	mSurface = new ORXSurface(this);
	setContentView(mSurface);
              SurfaceHolder holder = mSurface.getHolder();
              holder.setType(SurfaceHolder.SURFACE_TYPE_GPU);
       }

5. Transfer the game to an Android device and enjoy!

From newton64: Good luck!

From laschweinski: enjoy yourself in game development of orx. Thank you.