Simplify example a little bit.

Add documenation.


git-svn-id: http://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@4655 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2014-01-08 22:01:24 +00:00
parent 1a353ad8e7
commit 85cc90aeec
2 changed files with 72 additions and 22 deletions

View File

@ -28,33 +28,15 @@ enum GUI_IDS
IrrlichtDevice *startup(android_app* app)
{
// create device
IrrlichtDevice *device = 0;
SIrrlichtCreationParameters param;
param.DriverType = EDT_OGLES2;
param.WindowSize = dimension2d<u32>(480,854);
param.PrivateData = app;
param.Bits = 24;
param.ZBufferBits = 16;
param.ZBufferBits = 16;
param.AntiAlias = 0;
device = createDeviceEx(param);
if (!device)
return 0;
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
stringc mediaPath = "media/";
IGUIStaticText *text = guienv->addStaticText(L"FPS: 25",
rect<s32>(140,15,200,30), false, false, 0, GUI_INFO_FPS );
// add irrlicht logo
guienv->addImage(driver->getTexture(mediaPath + "irrlichtlogo3.png"),
core::position2d<s32>(0,-2));
return device;
return createDeviceEx(param);
}
/*! mainloop
@ -91,7 +73,6 @@ int example_helloworld(android_app* app)
{
// create device
IrrlichtDevice *device = startup(app);
if (device == 0)
return 1;
@ -100,6 +81,15 @@ int example_helloworld(android_app* app)
IGUIEnvironment* guienv = device->getGUIEnvironment();
stringc mediaPath = "media/";
IGUIStaticText *text = guienv->addStaticText(L"FPS: 25",
rect<s32>(140,15,200,30), false, false, 0, GUI_INFO_FPS );
// add irrlicht logo
guienv->addImage(driver->getTexture(mediaPath + "irrlichtlogo3.png"),
core::position2d<s32>(0,-2));
IAnimatedMesh* mesh = smgr->getMesh(mediaPath + "sydney.md2");

View File

@ -1,8 +1,15 @@
-----
SETUP
-----
To use Android you need to have installed:
- Android SDK (from http://developer.android.com)
- Android NDK (from http://developer.android.com)
- ant (a build tool commonly used for Java)
- A Java jdk (for example openjdk-6-jdk)
- GNU Make 3.81 or later
- A recent version of awk
- On Windows you need to have Cygwin (at least version 1.7) installed
1. Assign your Android SDK path to an ANDROID_HOME environment variable.
2. Add $ANDROID_HOME/tools and $ANDROID_HOME/platform-tools and the Android NDK main folder to your PATH environment variable.
@ -15,4 +22,57 @@ To use Android you need to have installed:
Troubleshooting:
Error: Unable to resolve project target 'android-10'
Solution: Run "android sdk" in sdk/tools and install API 10
Solution: Run "android sdk" in sdk/tools and install API 10.
Alternatively you can probably (not yet tested) set another APP_PLATFORM
in the Application.mk's for the project and for Irrlicht. In this case you
should likely also change the android:minSdkVersion in the AndroidManifest.xml
-----
FILES
-----
AndroidManifest.xml:
Every Android application needs one of those to describe the needs of the applicaiton.
Must have exactly this name.
See http://developer.android.com/guide/topics/manifest/manifest-intro.html
build.xml:
Ant build file to create the final package
jni:
A folder by this name _must_ exist.
Usually it contains the native (c/c++) source files, but in our case we put
the source-files one level higher (with LOCAL_PATH in Android.mk).
jni/Android.mk:
The Makefile for the project.
Source-files in the project are added to LOCAL_SRC_FILES
In the Irrlicht example it also copies the assets, but you can
also already create your project assets in the right place.
jni/Application.mk:
Optional file which for example restricts which modules are installed and
where you can set specific target architectures.
More info about this can be found in the ndk docs.
res:
A folder with resources which are compiled into your application and can be accessed via ID's.
There is also support for things like different target resolutions.
Please check the official "App Resources" android developer documention, as this is rather complex.
assets:
Files in here are distributed with your app. It's acting like a typical file system.
obj:
(not sure... but seems all objects files needed for linking are put in here before linking - even the libs)
libs:
The result of compiling your application is always a lib (probably because native code can't run directly but only as lib).
src:
Created by our makefile because the ant build.xml in the android sdk needs it for some reason. It's empty (so far?).
----------
DEPLOYMENT
----------
When you require EDT_OGLES2 your android:glEsVersion in AndroidManifest.xml should be "0x00020000"
while for EDT_OGLES1 it should be "0x00010000".