Remove android related code. It will be handled in different branch.

This commit is contained in:
Deve 2016-07-11 22:54:59 +02:00
parent 3728adf1c5
commit b25a4e874f
49 changed files with 0 additions and 22390 deletions

View File

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- BEGIN_INCLUDE(manifest) -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.supertuxkart.stk"
android:versionCode="1"
android:versionName="1.0">
<!-- This is the platform API where NativeActivity was introduced. -->
<uses-sdk android:minSdkVersion="21" />
<!-- This .apk has no Java code itself, so set hasCode to false. -->
<application android:debuggable="true" android:label="@string/app_name" android:hasCode="false">
<!-- Our activity is the built-in NativeActivity framework class.
This will take care of integrating with our NDK code. -->
<activity android:name="android.app.NativeActivity"
android:label="@string/app_name"
android:configChanges="keyboardHidden"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:icon="@drawable/stkicon">
<!-- Tell NativeActivity the name of or .so -->
<meta-data android:name="android.app.lib_name"
android:value="irrlicht2" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</manifest>
<!-- END_INCLUDE(manifest) -->

View File

@ -1,48 +0,0 @@
NDK_PATH=android-ndk-r10e/
NDK_STANDALONE=`pwd`/${NDK_PATH}
export PATH :=$(shell pwd)/obj/bin:${PATH}
# target: all - Default target. Build and create the apk.
all: build apk
# target: build - Build the native code
build: obj/freetype.stamp jni/ifaddrs/ifaddrs.h jni/jpeglib/jpeglib.h
NDK_CCACHE=ccache ${NDK_PATH}/ndk-build -j3
# target: apk - Make a debug APK
apk:
ant debug
# target: install - Install the debug APK to the plugged device/emulator
install:
ant installd
# target: help - Display callable targets.
help:
egrep "^# target:" [Mm]akefile
run:
adb shell am start -n org.supertuxkart.stk/android.app.NativeActivity
stop:
adb shell am force-stop org.supertuxkart.stk
obj/freetype.stamp:
mkdir -p obj/deps && cd obj/deps && wget http://mirror6.layerjet.com/nongnu//freetype/freetype-2.6.tar.gz && tar -xzf freetype-2.6.tar.gz
mkdir -p obj/freetype
${NDK_PATH}/build/tools/make-standalone-toolchain.sh \
--platform=android-21 --install-dir=`pwd`/obj/ --arch=arm
cd obj/deps/freetype-2.6 && \
./configure --host=arm-linux-androideabi --prefix=/freetype --without-zlib --with-png=no --with-harfbuzz=no && \
make -j4 && \
make install DESTDIR=`pwd`/../../freetype && \
echo ${PATH}
touch obj/freetype.stamp
jni/ifaddrs/ifaddrs.h:
cd jni && git clone https://github.com/morristech/android-ifaddrs.git ifaddrs
jni/jpeglib/jpeglib.h:
git clone https://github.com/folecr/jpeg8d jni/jpeglib
#wget http://mirror6.layerjet.com/nongnu//freetype/freetype-2.6.tar.gz

View File

@ -1,142 +0,0 @@
precision mediump float;
/* Definitions */
#define Solid 0
#define Solid2Layer 1
#define LightMap 2
#define DetailMap 3
#define SphereMap 4
#define Reflection2Layer 5
#define TransparentAlphaChannel 6
#define TransparentAlphaChannelRef 7
#define TransparentVertexAlpha 8
#define TransparentReflection2Layer 9
/* Uniforms */
uniform int uMaterialType;
uniform bool uTextureUsage0;
uniform bool uTextureUsage1;
uniform sampler2D uTextureUnit0;
uniform sampler2D uTextureUnit1;
/* Varyings */
varying vec2 varTexCoord0;
varying vec2 varTexCoord1;
varying vec4 varVertexColor;
varying float varEyeDist;
vec4 renderSolid()
{
vec4 Color = varVertexColor;
if(uTextureUsage0)
Color *= texture2D(uTextureUnit0, varTexCoord0);
Color.a = 1.0;
return Color;
}
vec4 render2LayerSolid()
{
float BlendFactor = varVertexColor.a;
vec4 Texel0 = texture2D(uTextureUnit0, varTexCoord0);
vec4 Texel1 = texture2D(uTextureUnit1, varTexCoord1);
vec4 Color = Texel0 * BlendFactor + Texel1 * (1.0 - BlendFactor);
return Color;
}
vec4 renderLightMap()
{
vec4 Texel0 = texture2D(uTextureUnit0, varTexCoord0);
vec4 Texel1 = texture2D(uTextureUnit1, varTexCoord1);
vec4 Color = Texel0 * Texel1 * 4.0;
Color.a = Texel0.a * Texel0.a;
return Color;
}
vec4 renderDetailMap()
{
vec4 Texel0 = texture2D(uTextureUnit0, varTexCoord0);
vec4 Texel1 = texture2D(uTextureUnit1, varTexCoord1);
vec4 Color = Texel0;
Color += Texel1 - 0.5;
return Color;
}
vec4 renderReflection2Layer()
{
vec4 Color = varVertexColor;
vec4 Texel0 = texture2D(uTextureUnit0, varTexCoord0);
vec4 Texel1 = texture2D(uTextureUnit1, varTexCoord1);
Color *= Texel0 * Texel1;
return Color;
}
vec4 renderTransparent()
{
vec4 Color = vec4(1.0, 1.0, 1.0, 1.0);
if(uTextureUsage0)
Color *= texture2D(uTextureUnit0, varTexCoord0);
return Color;
}
void main ()
{
if (uMaterialType == Solid)
gl_FragColor = renderSolid();
else if(uMaterialType == Solid2Layer)
gl_FragColor = render2LayerSolid();
else if(uMaterialType == LightMap)
gl_FragColor = renderLightMap();
else if(uMaterialType == DetailMap)
gl_FragColor = renderDetailMap();
else if(uMaterialType == SphereMap)
gl_FragColor = renderSolid();
else if(uMaterialType == Reflection2Layer)
gl_FragColor = renderReflection2Layer();
else if(uMaterialType == TransparentAlphaChannel)
gl_FragColor = renderTransparent();
else if(uMaterialType == TransparentAlphaChannelRef)
{
vec4 Color = renderTransparent();
if (Color.a < 0.5)
discard;
gl_FragColor = Color;
}
else if(uMaterialType == TransparentVertexAlpha)
{
vec4 Color = renderTransparent();
Color.a = varVertexColor.a;
gl_FragColor = Color;
}
else if(uMaterialType == TransparentReflection2Layer)
{
vec4 Color = renderReflection2Layer();
Color.a = varVertexColor.a;
gl_FragColor = Color;
}
else
gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
}

View File

@ -1,36 +0,0 @@
/* Attributes */
attribute vec3 inVertexPosition;
attribute vec3 inVertexNormal;
attribute vec4 inVertexColor;
attribute vec2 inTexCoord0;
attribute vec2 inTexCoord1;
/* Uniforms */
uniform int uMaterialType;
uniform mat4 uMvpMatrix;
uniform mat4 uTextureMatrix0;
uniform mat4 uTextureMatrix1;
/* Varyings */
varying vec2 varTexCoord0;
varying vec2 varTexCoord1;
varying vec4 varVertexColor;
varying float varEyeDist;
void main(void)
{
gl_Position = uMvpMatrix * vec4(inVertexPosition,1.0);
vec4 TexCoord0 = vec4(inTexCoord0.x, inTexCoord0.y, 0.0, 0.0);
varTexCoord0 = vec4(uTextureMatrix0 * TexCoord0).xy;
vec4 TexCoord1 = vec4(inTexCoord1.x, inTexCoord1.y, 0.0, 0.0);
varTexCoord1 = vec4(uTextureMatrix1 * TexCoord1).xy;
varVertexColor = inVertexColor.zyxw;
}

View File

@ -1,36 +0,0 @@
// Copyright (C) 2009-2010 Amundis
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
// and OpenGL ES driver implemented by Christian Stehno
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h
#define MAX_LIGHTS 2
precision mediump float;
uniform sampler2D texture0;
uniform sampler2D texture1;
varying vec4 varTexCoord;
varying vec3 varLightVector[MAX_LIGHTS];
varying vec4 varLightColor[MAX_LIGHTS];
varying vec4 debug;
void main(void)
{
// fetch color and normal map
vec4 normalMap = texture2D(texture1, varTexCoord.xy) * 2.0 - 1.0;
vec4 colorMap = texture2D(texture0, varTexCoord.xy);
// calculate color of light 0
vec4 color = clamp(varLightColor[0], 0.0, 1.0) * dot(normalMap.xyz, normalize(varLightVector[0].xyz));
// calculate color of light 1
color += clamp(varLightColor[1], 0.0, 1.0) * dot(normalMap.xyz, normalize(varLightVector[1].xyz));
//luminance * base color
color *= colorMap;
color.a = varLightColor[0].a;
gl_FragColor = color;
}

View File

@ -1,69 +0,0 @@
// Copyright (C) 2009-2010 Amundis
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
// and OpenGL ES driver implemented by Christian Stehno
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h
#define MAX_LIGHTS 2
attribute vec4 inVertexPosition;
attribute vec4 inVertexColor;
attribute vec4 inTexCoord0;
attribute vec3 inVertexNormal;
attribute vec3 inVertexTangent;
attribute vec3 inVertexBinormal;
uniform mat4 uMvpMatrix;
uniform vec4 uLightPos[MAX_LIGHTS];
uniform vec4 uLightColor[MAX_LIGHTS];
varying vec4 varTexCoord;
varying vec3 varLightVector[MAX_LIGHTS];
varying vec4 varLightColor[MAX_LIGHTS];
varying vec4 debug;
void main(void)
{
debug = vec4(inVertexNormal, 1.0);
// transform position to clip space
gl_Position = uMvpMatrix * inVertexPosition;
// vertex - lightpositions
vec4 tempLightVector0 = uLightPos[0] - inVertexPosition;
vec4 tempLightVector1 = uLightPos[1] - inVertexPosition;
// transform the light vector 1 with U, V, W
varLightVector[0].x = dot(inVertexTangent, tempLightVector0.xyz);
varLightVector[0].y = dot(inVertexBinormal, tempLightVector0.xyz);
varLightVector[0].z = dot(inVertexNormal, tempLightVector0.xyz);
// transform the light vector 2 with U, V, W
varLightVector[1].x = dot(inVertexTangent, tempLightVector1.xyz);
varLightVector[1].y = dot(inVertexBinormal, tempLightVector1.xyz);
varLightVector[1].z = dot(inVertexNormal, tempLightVector1.xyz);
// calculate attenuation of light 0
varLightColor[0].w = 0.0;
varLightColor[0].x = dot(tempLightVector0, tempLightVector0);
varLightColor[0].x *= uLightColor[0].w;
varLightColor[0] = vec4(inversesqrt(varLightColor[0].x));
varLightColor[0] *= uLightColor[0];
// normalize light vector 0
varLightVector[0] = normalize(varLightVector[0]);
// calculate attenuation of light 1
varLightColor[1].w = 0.0;
varLightColor[1].x = dot(tempLightVector1, tempLightVector1);
varLightColor[1].x *= uLightColor[1].w;
varLightColor[1] = vec4(inversesqrt(varLightColor[1].x));
varLightColor[1] *= uLightColor[1];
// normalize light vector 1
varLightVector[1] = normalize(varLightVector[1]);
// move out texture coordinates and original alpha value
varTexCoord = inTexCoord0;
varLightColor[0].a = inVertexColor.a;
}

View File

@ -1,49 +0,0 @@
// Copyright (C) 2009-2010 Amundis
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
// and OpenGL ES driver implemented by Christian Stehno
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h
#define MAX_LIGHTS 2
precision mediump float;
uniform sampler2D texture0;
uniform sampler2D texture1;
//uniform vec4 uLightDiffuse[MAX_LIGHTS];
uniform float uHeightScale;
varying vec4 varTexCoord;
varying vec3 varLightVector[MAX_LIGHTS];
varying vec4 varLightColor[MAX_LIGHTS];
varying vec3 varEyeVector;
varying vec4 debug;
void main(void)
{
// fetch color and normal map
vec4 normalMap = texture2D(texture1, varTexCoord.xy) * 2.0 - 1.0;
// height = height * scale
normalMap *= uHeightScale;
// calculate new texture coord: height * eye + oldTexCoord
vec2 offset = varEyeVector.xy * normalMap.w + varTexCoord.xy;
// fetch new textures
vec4 colorMap = texture2D(texture0, offset);
normalMap = normalize(texture2D(texture1, offset) * 2.0 - 1.0);
// calculate color of light 0
vec4 color = clamp(varLightColor[0], 0.0, 1.0) * dot(normalMap.xyz, normalize(varLightVector[0].xyz));
// calculate color of light 1
color += clamp(varLightColor[1], 0.0, 1.0) * dot(normalMap.xyz, normalize(varLightVector[1].xyz));
//luminance * base color
color *= colorMap;
color.a = varLightColor[0].a;
gl_FragColor = color;
}

View File

@ -1,81 +0,0 @@
// Copyright (C) 2009-2010 Amundis
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
// and OpenGL ES driver implemented by Christian Stehno
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h
#define MAX_LIGHTS 2
attribute vec4 inVertexPosition;
attribute vec4 inVertexColor;
attribute vec4 inTexCoord0;
attribute vec3 inVertexNormal;
attribute vec3 inVertexTangent;
attribute vec3 inVertexBinormal;
uniform mat4 uMvpMatrix;
uniform vec4 uLightPos[MAX_LIGHTS];
uniform vec4 uLightColor[MAX_LIGHTS];
uniform vec3 uEyePos;
varying vec4 varTexCoord;
varying vec3 varLightVector[MAX_LIGHTS];
varying vec4 varLightColor[MAX_LIGHTS];
varying vec3 varEyeVector;
varying vec4 debug;
void main(void)
{
debug = vec4(inVertexNormal, 1.0);
// transform position to clip space
gl_Position = uMvpMatrix * inVertexPosition;
// vertex - lightpositions
vec4 tempLightVector0 = uLightPos[0] - inVertexPosition;
vec4 tempLightVector1 = uLightPos[1] - inVertexPosition;
// eye vector
vec4 Temp = vec4(uEyePos, 1.0) - inVertexPosition;
// transform the light vector 1 with U, V, W
varLightVector[0].x = dot(inVertexTangent, tempLightVector0.xyz);
varLightVector[0].y = dot(inVertexBinormal, tempLightVector0.xyz);
varLightVector[0].z = dot(inVertexNormal, tempLightVector0.xyz);
// transform the light vector 2 with U, V, W
varLightVector[1].x = dot(inVertexTangent, tempLightVector1.xyz);
varLightVector[1].y = dot(inVertexBinormal, tempLightVector1.xyz);
varLightVector[1].z = dot(inVertexNormal, tempLightVector1.xyz);
// transform the eye vector with U, V, W
varEyeVector.x = dot(inVertexTangent, Temp.xyz);
varEyeVector.y = dot(inVertexBinormal, Temp.xyz);
varEyeVector.z = dot(inVertexNormal, Temp.xyz);
varEyeVector *= vec3(1.0,-1.0, -1.0);
varEyeVector = normalize(varEyeVector);
// calculate attenuation of light 0
varLightColor[0].w = 0.0;
varLightColor[0].x = dot(tempLightVector0, tempLightVector0);
varLightColor[0].x *= uLightColor[0].w;
varLightColor[0] = vec4(inversesqrt(varLightColor[0].x));
varLightColor[0] *= uLightColor[0];
// normalize light vector 0
varLightVector[0] = normalize(varLightVector[0]);
// calculate attenuation of light 1
varLightColor[1].w = 0.0;
varLightColor[1].x = dot(tempLightVector1, tempLightVector1);
varLightColor[1].x *= uLightColor[1].w;
varLightColor[1] = vec4(inversesqrt(varLightColor[1].x));
varLightColor[1] *= uLightColor[1];
// normalize light vector 1
varLightVector[1] = normalize(varLightVector[1]);
// move out texture coordinates and original alpha value
varTexCoord = inTexCoord0;
varLightColor[0].a = inVertexColor.a;
}

View File

@ -1,23 +0,0 @@
// Copyright (C) 2009-2010 Amundis
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
// and OpenGL ES driver implemented by Christian Stehno
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h
precision mediump float;
uniform bool uUseTexture;
uniform sampler2D uTextureUnit;
varying vec4 vVertexColor;
varying vec2 vTexCoord;
void main(void)
{
vec4 Color = vVertexColor;
if(uUseTexture)
Color *= texture2D(uTextureUnit, vTexCoord);
gl_FragColor = Color;
}

View File

@ -1,21 +0,0 @@
// Copyright (C) 2009-2010 Amundis
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
// and OpenGL ES driver implemented by Christian Stehno
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h
attribute vec4 inVertexPosition;
attribute vec4 inVertexColor;
attribute vec2 inTexCoord0;
uniform mat4 uOrthoMatrix;
varying vec4 vVertexColor;
varying vec2 vTexCoord;
void main(void)
{
gl_Position = uOrthoMatrix * inVertexPosition;
vVertexColor = inVertexColor.bgra;
vTexCoord = inTexCoord0;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

View File

@ -1,51 +0,0 @@
Dwarf lowpoly model Pack
Copyright 2004, Psionic Design
e-mail: psionic@blueyonder.co.uk
INSTALLATION INSTRUCTIONS:
To install, simply unzip to your hard drive with the "Use Folder Names" option turned on. And that's it you're ready to go!
USAGE INFORMATION:
Each zip contains the models, textures and animation info for that particular format!
Please Read the "animationinfo.txt" file included in each zip for the exact frames of animation to use
Credits to me "Psionic" are really appreciated but are not essential ;-)
Any questions, screenshots of him in use etc drop by my site or email me at:-
website: http://www.psionic3d.co.uk
email: psionic@blueyonder.co.uk
WHAT'S INCLUDED IN THE ZIP:
ReadMe.txt - This file
b3d.zip - Blitz 3D Format models and textures
ms3d.zip - Milkshape 3D Format models and textures
x.zip - DarkBasic Direct X 8 Format models and textures
RESTRICTIONS:
This model pack is available for use in freeware, shareware, commercial games/software with the following restrictions:-
**You may not sell/re-sell this model pack or claim it as your own.
***You may not redistribute this pack in some other model pack through a website or on a compilation CD of any kind, without my written consent.
Psi
http://www.psionic3d.co.uk

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

View File

@ -1,85 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="NativeActivity" default="help">
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
<loadproperties srcFile="local.properties" />
<!-- The ant.properties file can be created by you. It is only edited by the
'android' tool to add properties to it.
This is the place to change some Ant specific build properties.
Here are some properties you may want to change/update:
source.dir
The name of the source directory. Default is 'src'.
out.dir
The name of the output directory. Default is 'bin'.
For other overridable properties, look at the beginning of the rules
files in the SDK, at tools/ant/build.xml
Properties related to the SDK location or the project target should
be updated using the 'android' tool with the 'update' action.
This file is an integral part of the build system for your
application and should be checked into Version Control Systems.
-->
<property file="ant.properties" />
<!-- The project.properties file is created and updated by the 'android'
tool, as well as ADT.
This contains project specific properties such as project target, and library
dependencies. Lower level build properties are stored in ant.properties
(or in .classpath for Eclipse projects).
This file is an integral part of the build system for your
application and should be checked into Version Control Systems. -->
<loadproperties srcFile="project.properties" />
<!-- quick check on sdk.dir -->
<fail
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
unless="sdk.dir"
/>
<!-- extension targets. Uncomment the ones where you want to do custom work
in between standard targets -->
<!--
<target name="-pre-build">
</target>
<target name="-pre-compile">
</target>
/* This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir} */
<target name="-post-compile">
</target>
-->
<!-- Import the actual build file.
To customize existing targets, there are two options:
- Customize only one target:
- copy/paste the target into this file, *before* the
<import> task.
- customize it to your needs.
- Customize the whole content of build.xml
- copy/paste the content of the rules files (minus the top node)
into this file, replacing the <import> task.
- customize to your needs.
***********************
****** IMPORTANT ******
***********************
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
in order to avoid having your file be overridden by tools such as "android update project"
-->
<!-- version-tag: 1 -->
<import file="${sdk.dir}/tools/ant/build.xml" />
</project>

View File

@ -1,218 +0,0 @@
# Copyright (C) 2010 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
LOCAL_PATH := $(call my-dir)
#include $(CLEAR_VARS)
#LOCAL_MODULE := my_gnustl_shared
#LOCAL_SRC_FILES := external/lib/$(TARGET_ARCH_ABI)/libgnustl_shared.so
#include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
# PNG
LOCAL_CPP_FEATURES += rtti
LOCAL_MODULE := png
LOCAL_SRC_FILES = libpng/example.c \
libpng/png.c \
libpng/pngerror.c \
libpng/pngget.c \
libpng/pngmem.c \
libpng/pngpread.c \
libpng/pngread.c \
libpng/pngrio.c \
libpng/pngrtran.c \
libpng/pngrutil.c \
libpng/pngset.c \
libpng/pngtest.c \
libpng/pngtrans.c \
libpng/pngwio.c \
libpng/pngwrite.c \
libpng/pngwtran.c \
libpng/pngwutil.c \
zlib/adler32.c \
zlib/compress.c \
zlib/crc32.c \
zlib/deflate.c \
zlib/gzclose.c \
zlib/gzlib.c \
zlib/gzread.c \
zlib/gzwrite.c \
zlib/infback.c \
zlib/inffast.c \
zlib/inflate.c \
zlib/inftrees.c \
zlib/trees.c \
zlib/uncompr.c \
zlib/zutil.c
LOCAL_LDLIBS := -llog -landroid -lEGL -lGLESv1_CM -lGLESv2
LOCAL_CFLAGS := -I./../include/ -I./include/ -I.
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
# AngelScript
ANGELSCRIPT_INCLUDE := /angelscript/include/
# -----------------------------------------------------
# Build the AngelScript library
# -----------------------------------------------------
include $(CLEAR_VARS)
LOCAL_MODULE := libangelscript
LOCAL_CPP_FEATURES += rtti exceptions
LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/angelscript/source/*.S)
LOCAL_SRC_FILES += $(wildcard $(LOCAL_PATH)/angelscript/source/*.cpp)
LOCAL_PATH:=.
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_CPP_FEATURES += rtti
LOCAL_PATH := .
# ENET
LOCAL_SRC_FILES := $(wildcard jni/enet/*.c)
LOCAL_MODULE := enet
LOCAL_LDLIBS := -llog -landroid
LOCAL_CFLAGS := -DHAS_SOCKLEN_T -Ijni/ -Ijni/enet/include/
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
# ------------------------------------------------------------------
# Static library for Cocos
# ------------------------------------------------------------------
include $(CLEAR_VARS)
LOCAL_PATH := jni/jpeglib/
LOCAL_MODULE := jpeglib
LOCAL_MODULE_FILENAME := libjpeg
LOCAL_SRC_FILES := \
jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c \
jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \
jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c \
jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c \
jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c \
jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c \
jfdctint.c jidctflt.c jidctfst.c jidctint.c jquant1.c \
jquant2.c jutils.c jmemmgr.c jcarith.c jdarith.c jaricom.c
# Use the no backing store memory manager provided by
# libjpeg. See install.txt
LOCAL_SRC_FILES += \
jmemnobs.c
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_CPP_FEATURES += rtti
# glew
LOCAL_PATH:= jni
LOCAL_SRC_FILES := jni/glew/src/glew.c
LOCAL_PATH := .
LOCAL_MODULE := glew
LOCAL_LDLIBS := -llog -landroid
LOCAL_CFLAGS := -Ijni/glew/include -DGLEW_NO_GLU
#include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_CPP_FEATURES += rtti
# Bullet
LOCAL_SRC_FILES := $(wildcard jni/bullet/src/*/*.cpp)
LOCAL_SRC_FILES += $(wildcard jni/bullet/src/*/*/*.cpp)
LOCAL_PATH:=.
LOCAL_MODULE := bullet
LOCAL_LDLIBS := -llog -landroid -lEGL -lGLESv1_CM -lGLESv2
LOCAL_CFLAGS := -Ijni/bullet/src/ -I../include -I../../include
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
# ifaddrs
LOCAL_SRC_FILES := jni/ifaddrs/ifaddrs.c
LOCAL_PATH:=.
LOCAL_MODULE := ifaddrs
LOCAL_LDLIBS := -llog -landroid
LOCAL_CFLAGS := -Ijni/ifaddrs/
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
# Freetype
LOCAL_MODULE := freetype
LOCAL_PATH := .
LOCAL_SRC_FILES := obj/freetype/freetype/lib/libfreetype.a
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include $(LOCAL_PATH)/include/freetype2
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_CPP_FEATURES += rtti
LOCAL_PATH:= jni
# Irrlicht
LOCAL_SRC_FILES := $(wildcard jni/irrlicht/source/Irrlicht/*.cpp) $(wildcard jni/irrlicht/source/Irrlicht/Android/*.cpp)
LOCAL_PATH:=.
LOCAL_MODULE := irrlicht
LOCAL_LDLIBS := -llog -landroid -lEGL -lGLESv1_CM -lGLESv2
LOCAL_CFLAGS := -Ijni/irrlicht/source/Irrlicht/ -Ijni/irrlicht/include/ -Ijni/jpeglib/ -Ijni/libpng/ -Ijni/ -Iinclude/ -I$(call my-dir)/../../sources/android/native_app_glue/ -DBUILD_OGLES2 -DNO_IRR_COMPILE_WITH_SOFTWARE_ -DNO_IRR_COMPILE_WITH_BURNINGSVIDEO_
LOCAL_STATIC_LIBRARIES := jpeglib png
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_PATH:= jni
LOCAL_CPP_FEATURES += rtti exceptions
# STK
LOCAL_SRC_FILES := $(wildcard jni/src/*.cpp) $(wildcard jni/src/*/*.cpp) $(wildcard jni/src/*/*/*.cpp) jni/irrexample.cpp
LOCAL_PATH:=.
LOCAL_MODULE := stk
LOCAL_LDLIBS := -llog -landroid -lEGL -lGLESv1_CM -lGLESv2 -lGLESv3
LOCAL_CFLAGS := -Ijni/irrlicht/source/Irrlicht/ -Ijni/irrlicht/include/ -Ijni/jpeglib/ -Ijni/libpng/ -Ijni/ -Iinclude/ -I$(call my-dir)/../../sources/android/native_app_glue/ -DBUILD_OGLES2 -DNO_IRR_COMPILE_WITH_SOFTWARE_ -DNO_IRR_COMPILE_WITH_BURNINGSVIDEO_ -DSUPERTUXKART_DATADIR=\"/sdcard/stk/\" -DUSE_GLES2 -DANDROID -Ijni/src/ -Ijni/bullet/src -DNO_CURL -std=c++11 -Iobj/freetype/freetype/include/freetype2/ -Ijni/enet/include/ -Ijni/angelscript/include/ -DDEBUG -DNO_SOUND -DGLEW_NO_GLU -Ijni/ifaddrs
LOCAL_SHARED_LIBRARIES := irrlicht
LOCAL_STATIC_LIBRARIES := bullet enet freetype ifaddrs angelscript
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_PATH:= jni
LOCAL_MODULE := irrlicht2
LOCAL_SRC_FILES := main.c
LOCAL_LDLIBS := -llog -landroid -lEGL -lGLESv1_CM -lGLESv2
LOCAL_CFLAGS := -I./jni/irrlicht/include/ -Ijni/irrlicht/source/Irrlicht/ -DNO_CURL -DHAS_SOCKLEN_T -DSUPERTUXKART_DATADIR=\"/sdcard/stk/\"
LOCAL_STATIC_LIBRARIES := android_native_app_glue #jpeg #libirrlicht jpeg png
#LOCAL_SHARED_LIBRARIES := jpeg
include $(BUILD_SHARED_LIBRARY)
$(call import-module,android/native_app_glue)

View File

@ -1,3 +0,0 @@
APP_PLATFORM := android-21
APP_STL := gnustl_shared
APP_CPPFLAGS := -ggdb -O0

View File

@ -1 +0,0 @@
../../lib/angelscript/

View File

@ -1 +0,0 @@
../../lib/bullet/

View File

@ -1 +0,0 @@
../../lib/enet/

View File

@ -1 +0,0 @@
../../lib/glew

View File

@ -1,427 +0,0 @@
/** Example 008 SpecialFX
This tutorials describes how to do special effects. It shows how to use stencil
buffer shadows, the particle system, billboards, dynamic light, and the water
surface scene node.
We start like in some tutorials before. Please note that this time, the
'shadows' flag in createDevice() is set to true, for we want to have a dynamic
shadow casted from an animated character. If this example runs too slow,
set it to false. The Irrlicht Engine checks if your hardware doesn't support
the stencil buffer, and disables shadows by itself, but just in case the demo
runs slow on your hardware.
*/
#define _IRR_ANDROID_PLATFORM_
#include <irrlicht.h>
#ifndef _IRR_ANDROID_PLATFORM_
# include <iostream>
# include "driverChoice.h"
#else
# include "CAndroidAssetFileArchive.h"
# include <android/log.h>
# include <android_native_app_glue.h>
#include <assert.h>
#endif
using namespace irr;
#ifdef _MSC_VER
#pragma comment(lib, "Irrlicht.lib")
#endif
void* global_android_app;
void stk_main ();
void stk_run ();
#ifndef _IRR_ANDROID_PLATFORM_
int main()
#else
extern "C" void android_main2(struct android_app* app)
#endif
{
global_android_app = app;
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "Launching stk main…");
stk_main ();
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "Main launched, now the mainloop…");
stk_run ();
#ifdef _IRR_ANDROID_PLATFORM_
const bool shadows = false;
video::E_DRIVER_TYPE driverType=video::EDT_OGLES2;
#else
// ask if user would like shadows
char i;
printf("Please press 'y' if you want to use realtime shadows.\n");
std::cin >> i;
const bool shadows = (i == 'y');
// ask user for driver
video::E_DRIVER_TYPE driverType=driverChoiceConsole();
if (driverType==video::EDT_COUNT)
{
#ifdef _IRR_ANDROID_PLATFORM_
return;
#else
return 1;
#endif
}
#endif
/*
Create device and exit if creation failed. We make the stencil flag
optional to avoid slow screen modes for runs without shadows.
*/
#ifdef _IRR_ANDROID_PLATFORM_
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "The value of 1 + 4 is %d", 1+1);
struct irr::SIrrlichtCreationParameters p;
p.DriverType = driverType;
// The android app object is needed by the irrlicht device.
p.PrivateData = app;
p.WindowSize = core::dimension2d<u32>(1280,800);
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "frame %d", __LINE__);
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "frame %d %d", __LINE__, ((struct android_app *)(p.PrivateData))->window);
IrrlichtDevice *device = createDeviceEx(p);
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "frame %d", __LINE__);
#else
IrrlichtDevice *device =
createDevice(driverType, core::dimension2d<u32>(640, 480),
16, false, shadows);
#endif
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "frame %d", __LINE__);
if (device == 0)
{
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "frame %d", __LINE__);
#ifdef _IRR_ANDROID_PLATFORM_
return;
#else
return 1; // could not create selected driver.
#endif
}
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "frame %d", __LINE__);
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
scene::ISceneNode* node = 0;
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "frame %d", __LINE__);
/*
For our environment, we load a .3ds file. It is a small room I modelled
with Anim8or and exported into the 3ds format because the Irrlicht
Engine does not support the .an8 format. I am a very bad 3d graphic
artist, and so the texture mapping is not very nice in this model.
Luckily I am a better programmer than artist, and so the Irrlicht
Engine is able to create a cool texture mapping for me: Just use the
mesh manipulator and create a planar texture mapping for the mesh. If
you want to see the mapping I made with Anim8or, uncomment this line. I
also did not figure out how to set the material right in Anim8or, it
has a specular light color which I don't really like. I'll switch it
off too with this code.
*/
#ifdef _IRR_ANDROID_PLATFORM_
scene::IAnimatedMesh* mesh = smgr->getMesh("media/room.3ds");
#else
scene::IAnimatedMesh* mesh = smgr->getMesh("../../media/room.3ds");
#endif
if (mesh)
{
smgr->getMeshManipulator()->makePlanarTextureMapping(mesh->getMesh(0), 0.004f);
node = smgr->addAnimatedMeshSceneNode(mesh);
if (node)
{
//((scene::IAnimatedMeshSceneNode*)node)->addShadowVolumeSceneNode();
#ifdef _IRR_ANDROID_PLATFORM_
node->setMaterialTexture(0, driver->getTexture("media/wall.jpg"));
#else
node->setMaterialTexture(0, driver->getTexture("../../media/wall.jpg"));
#endif
node->getMaterial(0).SpecularColor.set(0,0,0,0);
}
}
/*
Now, for the first special effect: Animated water. It works like this:
The WaterSurfaceSceneNode takes a mesh as input and makes it wave like
a water surface. And if we let this scene node use a nice material like
the EMT_REFLECTION_2_LAYER, it looks really cool. We are doing this
with the next few lines of code. As input mesh, we create a hill plane
mesh, without hills. But any other mesh could be used for this, you
could even use the room.3ds (which would look really strange) if you
want to.
*/
mesh = 0;//smgr->addHillPlaneMesh( "myHill",
// core::dimension2d<f32>(20,20),
// core::dimension2d<u32>(40,40), 0, 0,
// core::dimension2d<f32>(0,0),
// core::dimension2d<f32>(10,10));
if (mesh)
{
node = smgr->addWaterSurfaceSceneNode(mesh->getMesh(0), 3.0f, 300.0f, 30.0f);
if (node)
{
node->setPosition(core::vector3df(0,7,0));
#ifdef _IRR_ANDROID_PLATFORM_
node->setMaterialTexture(0, driver->getTexture("media/stones.jpg"));
node->setMaterialTexture(1, driver->getTexture("media/water.jpg"));
#else
node->setMaterialTexture(0, driver->getTexture("../../media/stones.jpg"));
node->setMaterialTexture(1, driver->getTexture("../../media/water.jpg"));
#endif
node->setMaterialType(video::EMT_REFLECTION_2_LAYER);
}
}
/*
The second special effect is very basic, I bet you saw it already in
some Irrlicht Engine demos: A transparent billboard combined with a
dynamic light. We simply create a light scene node, let it fly around,
and to make it look more cool, we attach a billboard scene node to it.
*/
// create light
node = smgr->addLightSceneNode(0, core::vector3df(0,0,0),
video::SColorf(1.0f, 0.6f, 0.7f, 1.0f), 800.0f);
if (node)
{
scene::ISceneNodeAnimator* anim = 0;
anim = smgr->createFlyCircleAnimator (core::vector3df(0,150,0),250.0f);
node->addAnimator(anim);
anim->drop();
}
// attach billboard to light
node = smgr->addBillboardSceneNode(node, core::dimension2d<f32>(50, 50));
if (node)
{
node->setMaterialFlag(video::EMF_LIGHTING, false);
node->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
#ifdef _IRR_ANDROID_PLATFORM_
node->setMaterialTexture(0, driver->getTexture("media/particlewhite.bmp"));
#else
node->setMaterialTexture(0, driver->getTexture("../../media/particlewhite.bmp"));
#endif
}
/*
Next we add a volumetric light node, which adds a glowing fake area light to
the scene. Like with the billboards and particle systems we also assign a
texture for the desired effect, though this time we'll use a texture animator
to create the illusion of a magical glowing area effect.
*/
/*scene::IVolumeLightSceneNode * n = smgr->addVolumeLightSceneNode(0, -1,
32, // Subdivisions on U axis
32, // Subdivisions on V axis
video::SColor(0, 255, 255, 255), // foot color
video::SColor(0, 0, 0, 0)); // tail color*/
/*if (n)
{
n->setScale(core::vector3df(56.0f, 56.0f, 56.0f));
n->setPosition(core::vector3df(-120,50,40));
// load textures for animation
core::array<video::ITexture*> textures;
for (s32 g=7; g > 0; --g)
{
core::stringc tmp;
#ifdef _IRR_ANDROID_PLATFORM_
tmp = "media/portal";
#else
tmp = "../../media/portal";
#endif
tmp += g;
tmp += ".bmp";
video::ITexture* t = driver->getTexture( tmp.c_str() );
textures.push_back(t);
}
// create texture animator
scene::ISceneNodeAnimator* glow = smgr->createTextureAnimator(textures, 150);
// add the animator
n->addAnimator(glow);
// drop the animator because it was created with a create() function
glow->drop();
}*/
/*
The next special effect is a lot more interesting: A particle system.
The particle system in the Irrlicht Engine is quite modular and
extensible, but yet easy to use. There is a particle system scene node
into which you can put a particle emitter, which makes particles come out
of nothing. These emitters are quite flexible and usually have lots of
parameters like direction, amount, and color of the particles they
create.
There are different emitters, for example a point emitter which lets
particles pop out at a fixed point. If the particle emitters available
in the engine are not enough for you, you can easily create your own
ones, you'll simply have to create a class derived from the
IParticleEmitter interface and attach it to the particle system using
setEmitter(). In this example we create a box particle emitter, which
creates particles randomly inside a box. The parameters define the box,
direction of the particles, minimal and maximal new particles per
second, color, and minimal and maximal lifetime of the particles.
Because only with emitters particle system would be a little bit
boring, there are particle affectors which modify particles while
they fly around. Affectors can be added to a particle system for
simulating additional effects like gravity or wind.
The particle affector we use in this example is an affector which
modifies the color of the particles: It lets them fade out. Like the
particle emitters, additional particle affectors can also be
implemented by you, simply derive a class from IParticleAffector and
add it with addAffector().
After we set a nice material to the particle system, we have a cool
looking camp fire. By adjusting material, texture, particle emitter,
and affector parameters, it is also easily possible to create smoke,
rain, explosions, snow, and so on.
*/
// create a particle system
scene::IParticleSystemSceneNode* ps =
smgr->addParticleSystemSceneNode(false);
if (ps)
{
scene::IParticleEmitter* em = ps->createBoxEmitter(
core::aabbox3d<f32>(-7,0,-7,7,1,7), // emitter size
core::vector3df(0.0f,0.06f,0.0f), // initial direction
80,100, // emit rate
video::SColor(0,255,255,255), // darkest color
video::SColor(0,255,255,255), // brightest color
800,2000,0, // min and max age, angle
core::dimension2df(10.f,10.f), // min size
core::dimension2df(20.f,20.f)); // max size
ps->setEmitter(em); // this grabs the emitter
em->drop(); // so we can drop it here without deleting it
scene::IParticleAffector* paf = ps->createFadeOutParticleAffector();
ps->addAffector(paf); // same goes for the affector
paf->drop();
ps->setPosition(core::vector3df(-70,60,40));
ps->setScale(core::vector3df(2,2,2));
ps->setMaterialFlag(video::EMF_LIGHTING, false);
ps->setMaterialFlag(video::EMF_ZWRITE_ENABLE, false);
ps->setMaterialTexture(0, driver->getTexture("../../media/fire.bmp"));
ps->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
}
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "frame %d", __LINE__);
/*
As our last special effect, we want a dynamic shadow be casted from an
animated character. For this we load a DirectX .x model and place it
into our world. For creating the shadow, we simply need to call
addShadowVolumeSceneNode(). The color of shadows is only adjustable
globally for all shadows, by calling ISceneManager::setShadowColor().
Voila, here is our dynamic shadow.
Because the character is a little bit too small for this scene, we make
it bigger using setScale(). And because the character is lighted by a
dynamic light, we need to normalize the normals to make the lighting on
it correct. This is always necessary if the scale of a dynamic lighted
model is not (1,1,1). Otherwise it would get too dark or too bright
because the normals will be scaled too.
*/
// add animated character
#ifdef _IRR_ANDROID_PLATFORM_
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "frame %d", __LINE__);
mesh = smgr->getMesh("media/dwarf.x");
assert(mesh);
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "frame %d", __LINE__);
#else
mesh = smgr->getMesh("../../media/dwarf.x");
#endif
scene::IAnimatedMeshSceneNode* anode = 0;
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "frame %d", __LINE__);
anode = smgr->addAnimatedMeshSceneNode(mesh);
anode->setPosition(core::vector3df(-50,20,-60));
anode->setAnimationSpeed(15);
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "frame %d", __LINE__);
// add shadow
//anode->addShadowVolumeSceneNode();
smgr->setShadowColor(video::SColor(150,0,0,0));
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "frame %d", __LINE__);
// make the model a little bit bigger and normalize its normals
// because of the scaling, for correct lighting
anode->setScale(core::vector3df(2,2,2));
anode->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true);
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "frame %d", __LINE__);
/*
Finally we simply have to draw everything, that's all.
*/
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "frame %d", __LINE__);
scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS();
camera->setPosition(core::vector3df(-50,50,-150));
camera->setFarValue(10000.0f); // this increase a shadow visible range.
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "frame %d", __LINE__);
// disable mouse cursor
device->getCursorControl()->setVisible(false);
s32 lastFPS = -1;
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "frame %d", __LINE__);
while(device->run())
if (device->isWindowActive())
{
driver->beginScene(true, true, 0);
smgr->drawAll();
driver->endScene();
const s32 fps = driver->getFPS();
if (lastFPS != fps)
{
core::stringw str = L"Irrlicht Engine - SpecialFX example [";
str += driver->getName();
str += "] FPS:";
str += fps;
device->setWindowCaption(str.c_str());
lastFPS = fps;
}
}
device->drop();
#ifdef _IRR_ANDROID_PLATFORM_
return;
#else
return 0;
#endif
}
/*
**/

View File

@ -1 +0,0 @@
../../lib/irrlicht/

View File

@ -1 +0,0 @@
../../lib/libpng/

View File

@ -1,395 +0,0 @@
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
//BEGIN_INCLUDE(all)
#include <jni.h>
#include <errno.h>
#include <dlfcn.h>
#include <EGL/egl.h>
#include <GLES/gl.h>
#include <main.h>
#include <android/sensor.h>
#include <android/log.h>
#include <android_native_app_glue.h>
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "native-activity", __VA_ARGS__))
#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "native-activity", __VA_ARGS__))
void (*plug_set_window)(NativeWindowType);
void (*plug_set_width)(int);
void (*plug_set_height)(int);
void (*plug_main_loop_interation)(void);
void (*plug_android_main_2)(void*);
void (*plug_go_move)(int, int);
/**
* Our saved state data.
*/
struct saved_state {
float angle;
int32_t x;
int32_t y;
};
int android_height, android_width;
/**
* Shared state for our app.
*/
struct engine {
struct android_app* app;
ASensorManager* sensorManager;
const ASensor* accelerometerSensor;
ASensorEventQueue* sensorEventQueue;
int animating;
EGLDisplay display;
EGLSurface surface;
EGLContext context;
int32_t width;
int32_t height;
struct saved_state state;
};
#if 0
/**
* Initialize an EGL context for the current display.
*/
static int engine_init_display(struct engine* engine) {
// initialize OpenGL ES and EGL
/*
* Here specify the attributes of the desired configuration.
* Below, we select an EGLConfig with at least 8 bits per color
* component compatible with on-screen windows
*/
const EGLint attribs[] = {
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_BLUE_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_RED_SIZE, 8,
EGL_NONE
};
EGLint w, h, dummy, format;
EGLint numConfigs;
EGLConfig config;
EGLSurface surface;
EGLContext context;
EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(display, 0, 0);
/* Here, the application chooses the configuration it desires. In this
* sample, we have a very simplified selection process, where we pick
* the first EGLConfig that matches our criteria */
eglChooseConfig(display, attribs, &config, 1, &numConfigs);
/* EGL_NATIVE_VISUAL_ID is an attribute of the EGLConfig that is
* guaranteed to be accepted by ANativeWindow_setBuffersGeometry().
* As soon as we picked a EGLConfig, we can safely reconfigure the
* ANativeWindow buffers to match, using EGL_NATIVE_VISUAL_ID. */
eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, &format);
ANativeWindow_setBuffersGeometry(engine->app->window, 0, 0, format);
surface = eglCreateWindowSurface(display, config, engine->app->window, NULL);
context = eglCreateContext(display, config, NULL, NULL);
if (eglMakeCurrent(display, surface, surface, context) == EGL_FALSE) {
LOGW("Unable to eglMakeCurrent");
return -1;
}
eglQuerySurface(display, surface, EGL_WIDTH, &w);
eglQuerySurface(display, surface, EGL_HEIGHT, &h);
engine->display = display;
engine->context = context;
engine->surface = surface;
engine->width = w;
engine->height = h;
engine->state.angle = 0;
// Initialize GL state.
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
glEnable(GL_CULL_FACE);
glShadeModel(GL_SMOOTH);
glDisable(GL_DEPTH_TEST);
return 0;
}
#endif
/**
* Just the current frame in the display.
*/
static void engine_draw_frame(struct engine* engine) {
if (engine->display == NULL) {
// No display.
return;
}
// Just fill the screen with a color.
glClearColor(((float)engine->state.x)/engine->width, engine->state.angle,
((float)engine->state.y)/engine->height, 1);
glClear(GL_COLOR_BUFFER_BIT);
eglSwapBuffers(engine->display, engine->surface);
}
/**
* Tear down the EGL context currently associated with the display.
*/
static void engine_term_display(struct engine* engine) {
if (engine->display != EGL_NO_DISPLAY) {
eglMakeCurrent(engine->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
if (engine->context != EGL_NO_CONTEXT) {
eglDestroyContext(engine->display, engine->context);
}
if (engine->surface != EGL_NO_SURFACE) {
eglDestroySurface(engine->display, engine->surface);
}
eglTerminate(engine->display);
}
engine->animating = 0;
engine->display = EGL_NO_DISPLAY;
engine->context = EGL_NO_CONTEXT;
engine->surface = EGL_NO_SURFACE;
}
/**
* Process the next input event.
*/
static int32_t engine_handle_input(struct android_app* app, AInputEvent* event) {
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "input");
struct engine* engine = (struct engine*)app->userData;
if (AInputEvent_getType(event) == AINPUT_EVENT_TYPE_MOTION) {
int x = AMotionEvent_getX(event, 0);
int y = AMotionEvent_getY(event, 0);
int end = !(AKeyEvent_getAction(event) == AMOTION_EVENT_ACTION_UP);
if(x < 100) /* left */
{
plug_go_move(2, end);
}
else if(x > 700) /* right */
{
plug_go_move(3, end);
}
else if(y < 240) /* up */
{
plug_go_move(0, end);
}
else /* down */
{
plug_go_move(1, end);
}
LOGI("%d\n", AKeyEvent_getAction(event));
LOGI("up event: %d\n", AKeyEvent_getAction(event) == AMOTION_EVENT_ACTION_UP),
engine->animating = 1;
engine->state.x = AMotionEvent_getX(event, 0);
engine->state.y = AMotionEvent_getY(event, 0);
LOGI("%f", AMotionEvent_getX(event, 0));
return 1;
}
return 0;
}
/**
* Process the next main command.
*/
static void engine_handle_cmd(struct android_app* app, int32_t cmd) {
struct engine* engine = (struct engine*)app->userData;
switch (cmd) {
case APP_CMD_SAVE_STATE:
// The system has asked us to save our current state. Do so.
engine->app->savedState = malloc(sizeof(struct saved_state));
*((struct saved_state*)engine->app->savedState) = engine->state;
engine->app->savedStateSize = sizeof(struct saved_state);
break;
case APP_CMD_INIT_WINDOW:
// The window is being shown, get it ready.
if (engine->app->window != NULL) {
//__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "frame %d %d", __LINE__, app->window);
//plug_android_main_2(app);
/*LOGI("native: %d", engine->app->contentRect.left);*/
/* plug_set_width(1080);
plug_set_height(1920);
plug_set_window(engine->app->window);
plug_android_main_2 ();*/
}
engine->animating = 1;
break;
case APP_CMD_TERM_WINDOW:
// The window is being hidden or closed, clean it up.
engine_term_display(engine);
break;
case APP_CMD_GAINED_FOCUS:
// When our app gains focus, we start monitoring the accelerometer.
if (engine->accelerometerSensor != NULL) {
ASensorEventQueue_enableSensor(engine->sensorEventQueue,
engine->accelerometerSensor);
// We'd like to get 60 events per second (in us).
ASensorEventQueue_setEventRate(engine->sensorEventQueue,
engine->accelerometerSensor, (1000L/60)*1000);
}
break;
case APP_CMD_LOST_FOCUS:
// When our app loses focus, we stop monitoring the accelerometer.
// This is to avoid consuming battery while not being used.
if (engine->accelerometerSensor != NULL) {
ASensorEventQueue_disableSensor(engine->sensorEventQueue,
engine->accelerometerSensor);
}
// Also stop animating.
engine->animating = 0;
engine_draw_frame(engine);
break;
case APP_CMD_CONTENT_RECT_CHANGED:
LOGI("RESIZED");
LOGI("%d\n", ANativeWindow_getWidth(engine->app->window));
break;
}
}
/**
* This is the main entry point of a native application that is using
* android_native_app_glue. It runs in its own thread, with its own
* event loop for receiving input events and doing other things.
*/
void android_main(struct android_app* state) {
struct engine engine;
void * dlhandle = NULL;
void * dlstk = NULL;
/*dlstk = dlopen("/data/data/com.example.native_activity/lib/libjpeg.so", RTLD_NOW);*/
dlhandle = dlopen("/data/data/org.supertuxkart.stk/lib/libgnustl_shared.so", RTLD_NOW);
dlhandle = dlopen("/data/data/org.supertuxkart.stk/lib/libirrlicht.so", RTLD_NOW);
/*dlstk = dlopen("/data/data/com.example.native_activity/lib/libenet.so", RTLD_NOW);
dlstk = dlopen("/data/data/com.example.native_activity/lib/libbullet.so", RTLD_NOW);
dlstk = dlopen("/data/data/com.example.native_activity/lib/libstk.so", RTLD_NOW);*/
dlstk = dlopen("/data/data/org.supertuxkart.stk/lib/libenet.so", RTLD_NOW);
dlstk = dlopen("/data/data/org.supertuxkart.stk/lib/libbullet.so", RTLD_NOW);
dlstk = dlopen("/data/data/org.supertuxkart.stk/lib/libstk.so", RTLD_NOW);
if(dlhandle == NULL)
LOGW("Can't open libirrlicht.so. %s", dlerror());
if(dlstk == NULL)
LOGW("Can't open libstkmain.so. %s", dlerror());
//plug_main_loop_interation = (void(*)(void))dlsym(dlstk, "main_loop_interation");
//if(plug_main_loop_interation == NULL)
// LOGW("Can't open plug_main_loop");
plug_android_main_2 = (void(*)(void))dlsym(dlstk, "android_main2");
if(plug_android_main_2 == NULL)
LOGW("Can't find android_main2 %s", dlerror());
LOGW("----------------------------------------------------------- lanchit");
app_dummy();
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "frame %d %d", __LINE__, ((struct android_app *)(state))->window);
/*memset(&engine, 0, sizeof(engine));
state->userData = &engine;
state->onAppCmd = engine_handle_cmd;
state->onInputEvent = engine_handle_input;
engine.app = state;*/
// Prepare to monitor accelerometer
/* engine.sensorManager = ASensorManager_getInstance();
engine.accelerometerSensor = ASensorManager_getDefaultSensor(engine.sensorManager,
ASENSOR_TYPE_ACCELEROMETER);
engine.sensorEventQueue = ASensorManager_createEventQueue(engine.sensorManager,
state->looper, LOOPER_ID_USER, NULL, NULL);
if (state->savedState != NULL) {
// We are starting with a previous saved state; restore from it.
engine.state = *(struct saved_state*)state->savedState;
}*/
//plug_android_main_2(state);
plug_android_main_2(state);
/*if(plug_android_main_2 == NULL)
LOGW("Can't open plug_android_main_2");*/
/*plug_set_window = (void(*)(void))dlsym(dlhandle, "set_android_window");
if(plug_set_window == NULL)
LOGW("Can't open plug_set_window");*/
/*plug_set_width = (void(*)(void))dlsym(dlhandle, "set_android_window_width");
plug_set_height = (void(*)(void))dlsym(dlhandle, "set_android_window_height");
plug_go_move = (void(*)(int,int))dlsym(dlstk, "go_move");*/
// Make sure glue isn't stripped.
// loop waiting for stuff to do.
int i = 0;
while (1) {
i++;
// Read all pending events.
int ident;
int events;
struct android_poll_source* source;
// If not animating, we will block forever waiting for events.
// If animating, we loop until all events are read, then continue
// to draw the next frame of animation.
while ((ident=ALooper_pollAll(engine.animating ? 0 : -1, NULL, &events,
(void**)&source)) >= 0) {
// Process this event.
if (source != NULL) {
source->process(state, source);
}
// If a sensor has data, process it now.
if (ident == LOOPER_ID_USER) {
if (engine.accelerometerSensor != NULL) {
ASensorEvent event;
while (ASensorEventQueue_getEvents(engine.sensorEventQueue,
&event, 1) > 0) {
LOGI("accelerometer: x=%f y=%f z=%f",
event.acceleration.x, event.acceleration.y,
event.acceleration.z);
}
}
}
// Check if we are exiting.
if (state->destroyRequested != 0) {
engine_term_display(&engine);
return;
}
}
// LOGI("frame");
//plug_main_loop_interation();
if (engine.animating) {
// Done with events; draw next animation frame.
engine.state.angle += .01f;
if (engine.state.angle > 1) {
engine.state.angle = 0;
}
// Drawing is throttled to the screen update rate, so there
// is no need to do timing here.
}
if(i > 60000)
exit(0);
}
}
//END_INCLUDE(all)

View File

@ -1,171 +0,0 @@
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
//BEGIN_INCLUDE(all)
#include <jni.h>
#include <errno.h>
#include <EGL/egl.h>
#include <GLES/gl.h>
#include <android/sensor.h>
#include <android/log.h>
#include <android_native_app_glue.h>
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "native-activity", __VA_ARGS__))
#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "native-activity", __VA_ARGS__))
#include <irrlicht.h>
/*
In the Irrlicht Engine, everything can be found in the namespace 'irr'. So if
you want to use a class of the engine, you have to write irr:: before the name
of the class. For example to use the IrrlichtDevice write: irr::IrrlichtDevice.
To get rid of the irr:: in front of the name of every class, we tell the
compiler that we use that namespace from now on, and we will not have to write
irr:: anymore.
*/
using namespace irr;
/*
There are 5 sub namespaces in the Irrlicht Engine. Take a look at them, you can
read a detailed description of them in the documentation by clicking on the top
menu item 'Namespace List' or by using this link:
http://irrlicht.sourceforge.net/docu/namespaces.html
Like the irr namespace, we do not want these 5 sub namespaces now, to keep this
example simple. Hence, we tell the compiler again that we do not want always to
write their names.
*/
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
/**
* This is the main entry point of a native application that is using
* android_native_app_glue. It runs in its own thread, with its own
* event loop for receiving input events and doing other things.
*/
void android_main_2() {
/*
The most important function of the engine is the createDevice()
function. The IrrlichtDevice is created by it, which is the root
object for doing anything with the engine. createDevice() has 7
parameters:
- deviceType: Type of the device. This can currently be the Null-device,
one of the two software renderers, D3D8, D3D9, or OpenGL. In this
example we use EDT_SOFTWARE, but to try out, you might want to
change it to EDT_BURNINGSVIDEO, EDT_NULL, EDT_DIRECT3D8,
EDT_DIRECT3D9, or EDT_OPENGL.
- windowSize: Size of the Window or screen in FullScreenMode to be
created. In this example we use 640x480.
- bits: Amount of color bits per pixel. This should be 16 or 32. The
parameter is often ignored when running in windowed mode.
- fullscreen: Specifies if we want the device to run in fullscreen mode
or not.
- stencilbuffer: Specifies if we want to use the stencil buffer (for
drawing shadows).
- vsync: Specifies if we want to have vsync enabled, this is only useful
in fullscreen mode.
- eventReceiver: An object to receive events. We do not want to use this
parameter here, and set it to 0.
Always check the return value to cope with unsupported drivers,
dimensions, etc.
*/
IrrlichtDevice *device =
createDevice( video::EDT_OGLES1, dimension2d<u32>(640, 480), 16,
false, false, false, 0);
if (!device)
return ;
/*
Set the caption of the window to some nice text. Note that there is an
'L' in front of the string. The Irrlicht Engine uses wide character
strings when displaying text.
*/
device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");
/*
Get a pointer to the VideoDriver, the SceneManager and the graphical
user interface environment, so that we do not always have to write
device->getVideoDriver(), device->getSceneManager(), or
device->getGUIEnvironment().
*/
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
/*
We add a hello world label to the window, using the GUI environment.
The text is placed at the position (10,10) as top left corner and
(260,22) as lower right corner.
*/
guienv->addStaticText(L"Hello World! This is the Irrlicht Software renderer!",
rect<s32>(10,10,260,22), true);
/*
To look at the mesh, we place a camera into 3d space at the position
(0, 30, -40). The camera looks from there to (0,5,0), which is
approximately the place where our md2 model is.
*/
smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));
/*
Ok, now we have set up the scene, lets draw everything: We run the
device in a while() loop, until the device does not want to run any
more. This would be when the user closes the window or presses ALT+F4
(or whatever keycode closes a window).
*/
while(device->run())
{
/*
Anything can be drawn between a beginScene() and an endScene()
call. The beginScene() call clears the screen with a color and
the depth buffer, if desired. Then we let the Scene Manager and
the GUI Environment draw their content. With the endScene()
call everything is presented on the screen.
*/
driver->beginScene(true, true, SColor(255,100,101,140));
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
/*
After we are done with the render loop, we have to delete the Irrlicht
Device created before with createDevice(). In the Irrlicht Engine, you
have to delete all objects you created with a method or function which
starts with 'create'. The object is simply deleted by calling ->drop().
See the documentation at irr::IReferenceCounted::drop() for more
information.
*/
device->drop();
}
//END_INCLUDE(all)

View File

@ -1,2 +0,0 @@
void main_loop_interation();
void android_main_2();

View File

@ -1,84 +0,0 @@
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
//BEGIN_INCLUDE(all)
#include <jni.h>
#include <errno.h>
#include <EGL/egl.h>
#include <GLES/gl.h>
#include <android/sensor.h>
#include <android/log.h>
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "native-activity", __VA_ARGS__))
#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "native-activity", __VA_ARGS__))
#include <irrlicht.h>
#include <android/log.h>
#include "main_loop.hpp"
/*
In the Irrlicht Engine, everything can be found in the namespace 'irr'. So if
you want to use a class of the engine, you have to write irr:: before the name
of the class. For example to use the IrrlichtDevice write: irr::IrrlichtDevice.
To get rid of the irr:: in front of the name of every class, we tell the
compiler that we use that namespace from now on, and we will not have to write
irr:: anymore.
*/
using namespace irr;
/*
There are 5 sub namespaces in the Irrlicht Engine. Take a look at them, you can
read a detailed description of them in the documentation by clicking on the top
menu item 'Namespace List' or by using this link:
http://irrlicht.sourceforge.net/docu/namespaces.html
Like the irr namespace, we do not want these 5 sub namespaces now, to keep this
example simple. Hence, we tell the compiler again that we do not want always to
write their names.
*/
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
#define T __android_log_print(ANDROID_LOG_DEBUG, "L", "%s, %d: %s", __FILE__, __LINE__, __FUNCTION__);
int main2(int argc, char *argv[] );
/**
* This is the main entry point of a native application that is using
* android_native_app_glue. It runs in its own thread, with its own
* event loop for receiving input events and doing other things.
*/
static IrrlichtDevice *device;
static IVideoDriver* driver;
static ISceneManager* smgr;
static IGUIEnvironment* guienv;
extern int android_height, android_width;
extern "C" void android_main_2() {
LOGI("android");
main2(0, NULL);
LOGI("end main");
}
static bool first_run = true;
extern "C" void main_loop_interation(){
LOGI("Iteration");
if(first_run) main_loop->firstRun();
first_run = false;
main_loop->doIteration();
}
//END_INCLUDE(all)

View File

@ -1 +0,0 @@
../../src/

View File

@ -1,506 +0,0 @@
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2012 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#ifndef ZCONF_H
#define ZCONF_H
/*
* If you *really* need a unique prefix for all types and library functions,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
* Even better than compiling with -DZ_PREFIX would be to use configure to set
* this permanently in zconf.h using "./configure --zprefix".
*/
#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
# define Z_PREFIX_SET
/* all linked symbols */
# define _dist_code z__dist_code
# define _length_code z__length_code
# define _tr_align z__tr_align
# define _tr_flush_block z__tr_flush_block
# define _tr_init z__tr_init
# define _tr_stored_block z__tr_stored_block
# define _tr_tally z__tr_tally
# define adler32 z_adler32
# define adler32_combine z_adler32_combine
# define adler32_combine64 z_adler32_combine64
# ifndef Z_SOLO
# define compress z_compress
# define compress2 z_compress2
# define compressBound z_compressBound
# endif
# define crc32 z_crc32
# define crc32_combine z_crc32_combine
# define crc32_combine64 z_crc32_combine64
# define deflate z_deflate
# define deflateBound z_deflateBound
# define deflateCopy z_deflateCopy
# define deflateEnd z_deflateEnd
# define deflateInit2_ z_deflateInit2_
# define deflateInit_ z_deflateInit_
# define deflateParams z_deflateParams
# define deflatePending z_deflatePending
# define deflatePrime z_deflatePrime
# define deflateReset z_deflateReset
# define deflateResetKeep z_deflateResetKeep
# define deflateSetDictionary z_deflateSetDictionary
# define deflateSetHeader z_deflateSetHeader
# define deflateTune z_deflateTune
# define deflate_copyright z_deflate_copyright
# define get_crc_table z_get_crc_table
# ifndef Z_SOLO
# define gz_error z_gz_error
# define gz_intmax z_gz_intmax
# define gz_strwinerror z_gz_strwinerror
# define gzbuffer z_gzbuffer
# define gzclearerr z_gzclearerr
# define gzclose z_gzclose
# define gzclose_r z_gzclose_r
# define gzclose_w z_gzclose_w
# define gzdirect z_gzdirect
# define gzdopen z_gzdopen
# define gzeof z_gzeof
# define gzerror z_gzerror
# define gzflush z_gzflush
# define gzgetc z_gzgetc
# define gzgetc_ z_gzgetc_
# define gzgets z_gzgets
# define gzoffset z_gzoffset
# define gzoffset64 z_gzoffset64
# define gzopen z_gzopen
# define gzopen64 z_gzopen64
# ifdef _WIN32
# define gzopen_w z_gzopen_w
# endif
# define gzprintf z_gzprintf
# define gzputc z_gzputc
# define gzputs z_gzputs
# define gzread z_gzread
# define gzrewind z_gzrewind
# define gzseek z_gzseek
# define gzseek64 z_gzseek64
# define gzsetparams z_gzsetparams
# define gztell z_gztell
# define gztell64 z_gztell64
# define gzungetc z_gzungetc
# define gzwrite z_gzwrite
# endif
# define inflate z_inflate
# define inflateBack z_inflateBack
# define inflateBackEnd z_inflateBackEnd
# define inflateBackInit_ z_inflateBackInit_
# define inflateCopy z_inflateCopy
# define inflateEnd z_inflateEnd
# define inflateGetHeader z_inflateGetHeader
# define inflateInit2_ z_inflateInit2_
# define inflateInit_ z_inflateInit_
# define inflateMark z_inflateMark
# define inflatePrime z_inflatePrime
# define inflateReset z_inflateReset
# define inflateReset2 z_inflateReset2
# define inflateSetDictionary z_inflateSetDictionary
# define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint
# define inflateUndermine z_inflateUndermine
# define inflateResetKeep z_inflateResetKeep
# define inflate_copyright z_inflate_copyright
# define inflate_fast z_inflate_fast
# define inflate_table z_inflate_table
# ifndef Z_SOLO
# define uncompress z_uncompress
# endif
# define zError z_zError
# ifndef Z_SOLO
# define zcalloc z_zcalloc
# define zcfree z_zcfree
# endif
# define zlibCompileFlags z_zlibCompileFlags
# define zlibVersion z_zlibVersion
/* all zlib typedefs in zlib.h and zconf.h */
# define Byte z_Byte
# define Bytef z_Bytef
# define alloc_func z_alloc_func
# define charf z_charf
# define free_func z_free_func
# ifndef Z_SOLO
# define gzFile z_gzFile
# endif
# define gz_header z_gz_header
# define gz_headerp z_gz_headerp
# define in_func z_in_func
# define intf z_intf
# define out_func z_out_func
# define uInt z_uInt
# define uIntf z_uIntf
# define uLong z_uLong
# define uLongf z_uLongf
# define voidp z_voidp
# define voidpc z_voidpc
# define voidpf z_voidpf
/* all zlib structs in zlib.h and zconf.h */
# define gz_header_s z_gz_header_s
# define internal_state z_internal_state
#endif
#if defined(__MSDOS__) && !defined(MSDOS)
# define MSDOS
#endif
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
# define OS2
#endif
#if defined(_WINDOWS) && !defined(WINDOWS)
# define WINDOWS
#endif
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
# ifndef WIN32
# define WIN32
# endif
#endif
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
# ifndef SYS16BIT
# define SYS16BIT
# endif
# endif
#endif
/*
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
* than 64k bytes at a time (needed on systems with 16-bit int).
*/
#ifdef SYS16BIT
# define MAXSEG_64K
#endif
#ifdef MSDOS
# define UNALIGNED_OK
#endif
#ifdef __STDC_VERSION__
# ifndef STDC
# define STDC
# endif
# if __STDC_VERSION__ >= 199901L
# ifndef STDC99
# define STDC99
# endif
# endif
#endif
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
# define STDC
#endif
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
# define STDC
#endif
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
# define STDC
#endif
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
# define STDC
#endif
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
# define STDC
#endif
#ifndef STDC
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const /* note: need a more gentle solution here */
# endif
#endif
#if defined(ZLIB_CONST) && !defined(z_const)
# define z_const const
#else
# define z_const
#endif
/* Some Mac compilers merge all .h files incorrectly: */
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
# define NO_DUMMY_DECL
#endif
/* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL
# ifdef MAXSEG_64K
# define MAX_MEM_LEVEL 8
# else
# define MAX_MEM_LEVEL 9
# endif
#endif
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
* created by gzip. (Files created by minigzip can still be extracted by
* gzip.)
*/
#ifndef MAX_WBITS
# define MAX_WBITS 15 /* 32K LZ77 window */
#endif
/* The memory requirements for deflate are (in bytes):
(1 << (windowBits+2)) + (1 << (memLevel+9))
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
plus a few kilobytes for small objects. For example, if you want to reduce
the default memory requirements from 256K to 128K, compile with
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
Of course this will generally degrade compression (there's no free lunch).
The memory requirements for inflate are (in bytes) 1 << windowBits
that is, 32K for windowBits=15 (default value) plus a few kilobytes
for small objects.
*/
/* Type declarations */
#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
# else
# define OF(args) ()
# endif
#endif
#ifndef Z_ARG /* function prototypes for stdarg */
# if defined(STDC) || defined(Z_HAVE_STDARG_H)
# define Z_ARG(args) args
# else
# define Z_ARG(args) ()
# endif
#endif
/* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
* just define FAR to be empty.
*/
#ifdef SYS16BIT
# if defined(M_I86SM) || defined(M_I86MM)
/* MSC small or medium model */
# define SMALL_MEDIUM
# ifdef _MSC_VER
# define FAR _far
# else
# define FAR far
# endif
# endif
# if (defined(__SMALL__) || defined(__MEDIUM__))
/* Turbo C small or medium model */
# define SMALL_MEDIUM
# ifdef __BORLANDC__
# define FAR _far
# else
# define FAR far
# endif
# endif
#endif
#if defined(WINDOWS) || defined(WIN32)
/* If building or using zlib as a DLL, define ZLIB_DLL.
* This is not mandatory, but it offers a little performance increase.
*/
# ifdef ZLIB_DLL
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
# ifdef ZLIB_INTERNAL
# define ZEXTERN extern __declspec(dllexport)
# else
# define ZEXTERN extern __declspec(dllimport)
# endif
# endif
# endif /* ZLIB_DLL */
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
* define ZLIB_WINAPI.
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
*/
# ifdef ZLIB_WINAPI
# ifdef FAR
# undef FAR
# endif
# include <windows.h>
/* No need for _export, use ZLIB.DEF instead. */
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
# define ZEXPORT WINAPI
# ifdef WIN32
# define ZEXPORTVA WINAPIV
# else
# define ZEXPORTVA FAR CDECL
# endif
# endif
#endif
#if defined (__BEOS__)
# ifdef ZLIB_DLL
# ifdef ZLIB_INTERNAL
# define ZEXPORT __declspec(dllexport)
# define ZEXPORTVA __declspec(dllexport)
# else
# define ZEXPORT __declspec(dllimport)
# define ZEXPORTVA __declspec(dllimport)
# endif
# endif
#endif
#ifndef ZEXTERN
# define ZEXTERN extern
#endif
#ifndef ZEXPORT
# define ZEXPORT
#endif
#ifndef ZEXPORTVA
# define ZEXPORTVA
#endif
#ifndef FAR
# define FAR
#endif
#if !defined(__MACTYPES__)
typedef unsigned char Byte; /* 8 bits */
#endif
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
#ifdef SMALL_MEDIUM
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
# define Bytef Byte FAR
#else
typedef Byte FAR Bytef;
#endif
typedef char FAR charf;
typedef int FAR intf;
typedef uInt FAR uIntf;
typedef uLong FAR uLongf;
#ifdef STDC
typedef void const *voidpc;
typedef void FAR *voidpf;
typedef void *voidp;
#else
typedef Byte const *voidpc;
typedef Byte FAR *voidpf;
typedef Byte *voidp;
#endif
/* ./configure may #define Z_U4 here */
#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
# include <limits.h>
# if (UINT_MAX == 0xffffffffUL)
# define Z_U4 unsigned
# else
# if (ULONG_MAX == 0xffffffffUL)
# define Z_U4 unsigned long
# else
# if (USHRT_MAX == 0xffffffffUL)
# define Z_U4 unsigned short
# endif
# endif
# endif
#endif
#ifdef Z_U4
typedef Z_U4 z_crc_t;
#else
typedef unsigned long z_crc_t;
#endif
#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
# define Z_HAVE_UNISTD_H
#endif
#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */
# define Z_HAVE_STDARG_H
#endif
#ifdef STDC
# ifndef Z_SOLO
# include <sys/types.h> /* for off_t */
# endif
#endif
#ifdef _WIN32
# include <stddef.h> /* for wchar_t */
#endif
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
* though the former does not conform to the LFS document), but considering
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
* equivalently requesting no 64-bit operations
*/
#if defined(LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
# undef _LARGEFILE64_SOURCE
#endif
#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H)
# define Z_HAVE_UNISTD_H
#endif
#ifndef Z_SOLO
# if defined(Z_HAVE_UNISTD_H) || defined(LARGEFILE64_SOURCE)
# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
# ifdef VMS
# include <unixio.h> /* for off_t */
# endif
# ifndef z_off_t
# define z_off_t off_t
# endif
# endif
#endif
#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
# define Z_LFS64
#endif
#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
# define Z_LARGE64
#endif
#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
# define Z_WANT64
#endif
#if !defined(SEEK_SET) && !defined(Z_SOLO)
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif
#ifndef z_off_t
# define z_off_t long
#endif
#if !defined(_WIN32) && defined(Z_LARGE64)
# define z_off64_t off64_t
#else
# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
# define z_off64_t __int64
# else
# define z_off64_t z_off_t
# endif
#endif
/* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__)
#pragma map(deflateInit_,"DEIN")
#pragma map(deflateInit2_,"DEIN2")
#pragma map(deflateEnd,"DEEND")
#pragma map(deflateBound,"DEBND")
#pragma map(inflateInit_,"ININ")
#pragma map(inflateInit2_,"ININ2")
#pragma map(inflateEnd,"INEND")
#pragma map(inflateSync,"INSY")
#pragma map(inflateSetDictionary,"INSEDI")
#pragma map(compressBound,"CMBND")
#pragma map(inflate_table,"INTABL")
#pragma map(inflate_fast,"INFA")
#pragma map(inflate_copyright,"INCOPY")
#endif
#endif /* ZCONF_H */

View File

@ -1 +0,0 @@
../../lib/zlib/

View File

@ -1,10 +0,0 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked in Version Control Systems,
# as it contains information specific to your local configuration.
# location of the SDK. This is only used by Ant
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=/opt/android-sdk/

View File

@ -1,40 +0,0 @@
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}

View File

@ -1,11 +0,0 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "ant.properties", and override values to adapt the script to your
# project structure.
# Project target.
target=android-22

View File

@ -1,28 +0,0 @@
First, download and extract the ndk android-ndk-r10e to this folder (i.e. android/android-ndk-r10e/).
The android sdk must be installed in /opt.
ant is also needed.
[not needed anymore] Download a suitable jpeglib (done automatically by the Makefile)
================================================================
> git clone https://github.com/folecr/jpeg8d jni/jpeglib
Build an apk
============
> make build apk
Install and run
===============
> make install run
Install data set
================
I recommend to use a lighter data set, there is a patch in the android/ folder that can be applied to the
SVN version (keep a single track, a single kart and remove most materials).
A larger one may work too, but it will be way slower to load, and is likely to be killed by your device (but
maybe it works, I did not test).
> adb shell mkdir /sdcard/stk/
> adb push data /sdcard/stk/data/ # you have to be in the root of your stk-code
> adb push stk-assets /sdcard/stk/data/stk-assets # you have to be in the parent of stk-assets, but you guessed

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">SuperTuxKart</string>
</resources>

View File

@ -1,405 +0,0 @@
Index: textures/materials.xml
===================================================================
--- textures/materials.xml (révision 16568)
+++ textures/materials.xml (copie de travail)
@@ -1,42 +1,7 @@
<?xml version="1.0"?>
<materials>
- <!-- Booster -->
- <material name="gfx_booster_AlphaTest.png" shader="alphatest" >
- <zipper duration="3.5" max-speed-increase="15.0" fade-out-time="3.0" speed-gain="4.5" min-speed="37.0"/>
- </material>
- <!-- flags -->
- <material name="stkflag_valverdeVertical_a.png" shader="grass" />
- <material name="stklib_prayerFlags_a.png" shader="grass" />
-
- <material name="stkflag_stkVertical_a.png" shader="grass" />
- <material name="stkflag_saraVertical_a.png" shader="grass" />
- <material name="stkflag_goldCupVertical_a.png" shader="grass" />
- <material name="stkflag_orangeStartingLine_a.png" shader="alphatest" disable-z-write="Y"/>
- <material name="stkflag_orangeBooster_a.png" shader="alphatest" disable-z-write="Y" has-gravity="Y"/>
- <material name="stkflag_blueBooster_a.png" shader="alphatest" disable-z-write="Y" has-gravity="Y"/>
- <material name="stkflag_blueStartingLine_a.png" shader="alphatest" />
- <material name="stkflag_albikStartingLine_a.png" shader="alphatest" />
- <material name="stkflag_pinkStartingLine_a.png" shader="alphatest" />
-
- <material name="stk_grainElevatorLogoA.png" shader="alphatest" disable-z-write="Y"/>
-
-
- <!-- texture used for the 0.9 trailer
- <material name="engine.png" gloss-map="engine_gloss.png"/>
- <material name="tux_body.png" gloss-map="tux_body_gloss.png"/>
- <material name="tuxkart.png" gloss-map="tuxkart_gloss.png"/>
- <material name="wheel.png" gloss-map="wheel_gloss.png"/>
-
- <material name="stktex_aztekFeather_a.png" shader="alphatest"/>
-
-
-
- <material name="stktex_beachWomenRed_a.png" gloss-map="stktex_beachWomenBody_a_gloss.png"/>
- <material name="confetti.png" shader="alphablend" ignore="Y"/>
- -->
-
<!-- Particles -->
<material name="explode.png" shader="additive" ignore="Y"/>
<material name="confetti.png" shader="additive" ignore="Y"/>
@@ -62,357 +27,4 @@
<material name="waterparticles.png" shader="alphablend" ignore="Y"/>
<material name="gfx_mud_a.png" shader="alphablend" ignore="Y"/>
<material name="particle_water.png" shader="alphablend" ignore="Y"/>
-
- <material name="stktex_waterfall_a.png" shader="alphablend" ignore="Y"/>
-
- <material name="stk_generic_borderA.png" max-speed="0.4" slowdown-time="2.0" anisotropic="Y">
- <particles base="smoke.xml" condition="skid drive" />
- </material>
-
- <material name="stk_glassOrangeCocktail_a.png" shader="alphablend" ignore="Y"/>
- <material name="stk_glassPanel_a.png" shader="alphablend" ignore="Y"/>
- <material name="stk_generic_ice_alpha.png" shader="alphablend"/>
-
- <!-- Textures graphical-effect="normal_map" normal-map="stktex_generic_cobbleStoneA_nm.png" -->
- <material name="stktex_animatedFire_a.png" disable-z-write="Y" shader="additive"/>
- <material name="stktex_animatedPinkFire_a.png" disable-z-write="Y" shader="additive"/>
-
- <material name="gfx_distord_AlphaTested.png" shader="alphatest"/>
- <material name="gfx_lightBlinker_a.png" shader="alphatest"/>
- <material name="gfx_lightBlinker_b.png" shader="alphatest"/>
-
- <material name="stktex_generic_WoodA.png" >
- <sfx filename="wooden_bridge.ogg" rolloff="0.60" min_speed="9.00" max_speed="22.00" min_pitch="1.00" max_pitch="1.70" positional="Y" volume="1.00"/>
- </material>
-
-
- <material name="stktex_ants_a.png" shader="alphatest"/>
- <material name="stktex_valVerdeLocationAtlas_a.png" shader="alphatest"/>
- <material name="stktex_granParadisoLocation_a.png" shader="alphatest"/>
- <material name="stktex_silviaLocationAtlas_a.png" shader="alphatest"/>
-
-
- <material name="stktex_branches_diff_a.png" shader="grass" />
- <material name="stkflag_valverdeVertical_a.png" shader="grass" />
- <material name="stkflag_nolok_a.png" shader="grass" />
- <material name="stkflag_lamponeCouture_a.png" shader="grass" />
-
- <material name="stktex_cocoaTreeLeaf_a.png" shader="grass" />
-
- <material name="stktex_deadTree_a.png" shader="alphatest" ignore="Y" />
-
- <material name="stktex_coralBump_a.png" shader="grass" />
- <material name="stktex_seaFlower_a.png" shader="grass" />
- <material name="stktex_coralDisk_a.png" shader="grass" />
-
-
- <material name="stktex_lowPalmTree_a.png" shader="alphatest" />
- <material name="stklama_gravelRoad_a.png" shader="alphatest" ignore="Y" />
- <material name="stklama_roadSeparator_a.png" shader="alphatest" ignore="Y" />
-
- <material name="stk_generic_grid_b.png" shader="alphatest" />
- <material name="stk_metalTriangleStructure_a.png" shader="alphatest" />
-
- <material name="stktex_boxGrid_a.png" shader="alphatest" />
- <material name="stkcrowd_lowPoly_a.png" shader="alphatest" />
- <material name="stktex_flightList_a.png" shader="alphatest" />
- <material name="stkspon_japimpactDonator_a.png" shader="alphatest" />
-
- <material name="stkflag_cupcakeAirwayLogo_a.png" shader="alphatest" />
- <material name="stkflag_TCPLogo_a.png" shader="alphatest" />
-
- <material name="stk_metalDoor_a.png" gloss-map="stk_metalDoor_a_gloss.png" />
- <material name="motif.png" gloss-map="motif_gloss.png" />
- <material name="stktex_beachball_a.png" gloss-map="stktex_beachball_a_gloss.png" />
-
- <material name="stk_solarPanel_a.png" gloss-map="stk_solarPanel_gloss.png" graphical-effect="normal_map" normal-map="stk_solarPanel_a_nm.png" ignore="y"/>
-
- <material name="stk_generic_snow_a.png" max-speed="0.70" gloss-map="stk_generic_snow_a_gloss.png" normal-map="stk_generic_snow_a_nm.png"/>
-
- <material name="stktex_generic_roadSnow_a.png" gloss-map="stktex_generic_roadSnow_a_gloss.png" normal-map="stktex_generic_roadSnow_a_nm.png"/>
-
- <material name="stkflag_asianPaperLantern_a.png" gloss-map="stkflag_asianPaperLantern_a_gloss.png"/>
-
- <material name="stktex_planetEarth_a.png" gloss-map="stktex_planetEarth_a_gloss.png"/>
-
- <!-- Generic glow texture -->
- <material name="gfxGlow_yellow_a.png" gloss-map="gfxGlow_generic_a_gloss.png"/>
- <material name="gfxGlow_White_a.png" gloss-map="gfxGlow_generic_a_gloss.png"/>
- <material name="gfxGlow_red_a.png" gloss-map="gfxGlow_generic_a_gloss.png"/>
- <material name="gfxGlow_blue_a.png" gloss-map="gfxGlow_generic_a_gloss.png"/>
- <material name="gfxGlow_green_a.png" gloss-map="gfxGlow_generic_a_gloss.png"/>
-
- <material name="stktex_generic_lavaA.png" gloss-map="stktex_generic_lava_gloss.png" />
-
- <material name="stk_mudpot_a.png" gloss-map="stk_mudpot_a_gloss.png" />
- <material name="stkflag_latexBluePinkPattern_a.png" gloss-map="stkflag_latexBluePinkPattern_a_gloss.png"/>
-
- <material name="stkflag_leatherPatern_a.png" gloss-map="stkflag_leatherPatern_gloss.png"/>
-
- <material name="stk_generic_gridA.png" shader="alphatest" has-gravity="Y"/>
- <material name="stktex_lowPalmLeaf_a.png" shader="grass"/>
- <material name="stklib_conifer_a_low.png" shader="grass"/>
- <material name="stktex_seaweed_a.png" shader="grass"/>
-
-
-
- <material name="stktex_jungleLeaf_a.png" shader="grass" />
- <material name="stktex_cattail_diff_a.png" shader="grass" />
-
- <material name="stktex_usSignAtlas_a.png" shader="alphatest"/>
- <material name="stk_blueTurbine_a.png" shader="alphatest"/>
-
- <material name="stkflag_computerSpam_a.png" shader="alphatest"/>
-
- <material name="stk_lowPolyCars_a.png" shader="alphatest" gloss-map="gfxGlow_generic_a_gloss.png"/>
- <material name="stk_lowPolyFish_a.png" shader="alphatest"/>
-
- <material name="stk_lowPolyBuilding_a.png" shader="alphatest" />
-
- <material name="stk_metalGlobe_a.png" normal-map="stk_greyMetal_a_nm.png" gloss-map="stk_greyMetal_a_gloss.png" shader="alphatest"/>
-
-
- <material name="stktex_windowsSet_a.png" normal-map="stktex_windowsSet_a_nm.png" gloss-map="stktex_windowsSet_a_gloss.png" />
-
- <material name="stk_generic_bedRockLava_a.png" shader="alphatest"/>
- <material name="stktex_churchRosette_a.png" normal-map="stk_greyMetal_a_nm.png" gloss-map="stk_greyMetal_a_gloss.png" shader="alphatest"/>
- <material name="stktex_churchRosetteGlass_a.png" shader="alphablend"/>
-
-
-
- <material name="stk_terminalHappy_face_a.png" shader="alphatest"/>
- <material name="stktex_iceEdges_a.png" shader="alphablend"/>
- <material name="stk_snowMountain_a.png" shader="alphatest"/>
- <material name="stk_flyingPath_a.png" shader="alphatest"/>
- <material name="stkflag_welcome_a.png" shader="alphatest"/>
-
- <material name="stktex_stalactic_a.png" gloss-map="stk_generic_snow_a_gloss.png" shader="alphatest"/>
-
- <material name="stktex_palmLeaf_a.png" shader="grass" ignore="Y" />
- <material name="stktex_palmLeafDry_a.png" shader="grass" ignore="Y" />
- <material name="stktex_jungleLiana_a.png" shader="grass" ignore="Y" />
- <material name="stktex_jungleLiana_b.png" shader="grass" ignore="Y" />
-
- <material name="stktex_ivyVines_a.png" shader="grass" ignore="Y" />
-
- <material name="stk_accacia_a.png" shader="grass" ignore="Y" />
- <material name="stktex_agave_a.png" shader="grass" ignore="Y" />
- <material name="stk_pineBranch_a.png" shader="grass" ignore="Y" />
-
- <material name="gfx_resetWaterSplash_AlphaTested.png" falling-effect="Y" reset="Y" shader="alphatest"/>
-
- <material name="stk_grasscliff_a.png" shader="grass"/>
-
- <material name="stktex_jungleLeaf_b.png" shader="grass" ignore="Y" />
- <material name="stktex_waterLily_a.png" shader="grass" ignore="Y" />
- <material name="stk_grassAlpha.png" shader="grass" ignore="Y"/>
- <material name="stk_generic_colorfabricA.png" shader="grass" ignore="Y"/>
- <material name="gfx_leaf_a.png" compositing="blend"/>
- <material name="stk_darkSkidMark_a.png" compositing="blend"/>
- <material name="gfx_sparkFire_a.png" compositing="additive"/>
- <material name="gfx_sparkBlue_a.png" compositing="additive"/>
- <material name="gfx_sparkGreen_a.png" compositing="additive"/>
- <material name="gfx_electricArc_a.png" compositing="additive"/>
- <material name="gfx_yellowBeam_a.png" compositing="additive"/>
-
- <!-- Normal map -->
- <material name="stk_generic_rock_a.png" graphical-effect="normal_map" normal-map="stk_generic_rock_a_nm.png" gloss-map="stk_generic_rock_a_gloss.png"/>
- <material name="stk_generic_ice_a.png" graphical-effect="normal_map" normal-map="stk_generic_ice_a_nm.png" gloss-map="stk_generic_ice_a_gloss.png"/>
-
- <material name="stktex_frozenWaterFall_a.png" graphical-effect="normal_map" normal-map="stktex_frozenWaterFall_a_nm.png" gloss-map="stktex_frozenWaterFall_a_glossy.png"/>
- <material name="stktex_snowRock_a.png" graphical-effect="normal_map" normal-map="stktex_snowRock_a_nm.png" gloss-map="stktex_snowRock_a_gloss.png"/>
-
- <material name="stk_generic_brickA.png" graphical-effect="normal_map" normal-map="stk_generic_brickA_nm.png" gloss-map="stk_generic_brickA_gloss.png"/>
-
- <material name="stktex_generic_cobbleStoneA.png" has-gravity="Y" graphical-effect="normal_map" normal-map="stktex_generic_cobbleStoneA_nm.png"/>
- <material name="stk_generic_dirtRoad_a.png" has-gravity="Y" graphical-effect="normal_map" normal-map="stk_generic_dirtRoad_a_nm.png"/>
-
- <material name="stktex_generic_rockA.png" graphical-effect="normal_map" normal-map="stktex_generic_rockA_nm.png" gloss-map="stktex_generic_rockA_gloss.png"/>
- <material name="stk_greyMetal_a.png" graphical-effect="normal_map" normal-map="stk_greyMetal_a_nm.png" gloss-map="stk_greyMetal_a_gloss.png"/>
- <material name="stk_goldMetal_a.png" graphical-effect="normal_map" normal-map="stk_greyMetal_a_nm.png" gloss-map="stk_greyMetal_a_gloss.png"/>
- <material name="stk_redMetal_a.png" graphical-effect="normal_map" normal-map="stk_greyMetal_a_nm.png" gloss-map="stkflag_latexBluePinkPattern_a_gloss.png"/>
-
- <material name="stk_metalRustedBlue_a.png" graphical-effect="normal_map" normal-map="stk_greyMetal_a_nm.png" gloss-map="stk_greyMetal_a_gloss.png"/>
- <material name="stk_futureYellowBox_a.png" gloss-map="stk_futureYellowBox_a_gloss.png"/>
-
-<material name="stk_electronicalPattern_a.png" shader="additive" disable-z-write="Y"/>
-
- <material name="stk_lightGrayMetal_a.png" graphical-effect="normal_map" normal-map="stk_greyMetal_a_nm.png" gloss-map="stk_lightGreyMetal_a_gloss.png"/>
- <material name="stk_blueMetal_a.png" graphical-effect="normal_map" normal-map="stk_greyMetal_a_nm.png" gloss-map="stk_lightGreyMetal_a_gloss.png"/>
- <material name="stk_darkGrayMetal_a.png" graphical-effect="normal_map" normal-map="stk_greyMetal_a_nm.png" gloss-map="stk_lightGreyMetal_a_gloss.png"/>
-<material name="stktex_hexaJetRCAlivery_a.png" gloss-map="stk_lightGreyMetal_a_gloss.png"/>
-<material name="stktex_trijetTCPlivery_a.png" gloss-map="stk_lightGreyMetal_a_gloss.png"/>
-
- <material name="stk_generic_bedRock_a.png" graphical-effect="normal_map" normal-map="stk_generic_bedRock_a_nm.png" gloss-map="stk_generic_rock_a_gloss.png"/>
- <material name="stk_generic_pinkcrystal_a.png" graphical-effect="normal_map" normal-map="stk_generic_bedRock_a_nm.png" gloss-map="stk_greyMetal_a_gloss.png"/>
-
- <material name="stktex_generic_waterRockA.png" graphical-effect="normal_map" normal-map="stktex_generic_rockA_nm.png" gloss-map="stktex_generic_rockA_gloss.png"/>
- <material name="stktex_generic_aztekWall_a.png" graphical-effect="normal_map" normal-map="stktex_generic_aztekWall_a_nm.png"/>
- <material name="stk_generic_grassB.png" graphical-effect="normal_map" normal-map="stk_generic_grassB_nm.png"/>
- <material name="stktex_generic_WoodB.png" graphical-effect="normal_map" normal-map="stktex_generic_WoodB_nm.png" gloss-map="stktex_generic_WoodB_gloss.png"/>
-
-
-
-
-
-
- <material name="stk_generic_ironA.png" has-gravity="Y" />
- <material name="stktex_generic_concreteA.png" has-gravity="Y" />
-
-
- <material name="gfx_bubble_a.png" shader="alphablend" light="N"/>
- <material name="stktex_clouds_a.png" shader="additive" light="N"/>
-
- <material name="stkflag_saraAgency_a.png" shader="alphablend"/>
-
- <material name="gfx_cloudAnimated_a.png" shader="alphablend"/>
- <material name="gfx_sandAnimated_a.png" shader="alphablend"/>
- <material name="gfx_snowStormAnimated_a.png" shader="alphablend"/>
-
- <material name="stktex_blueNebula_a.png" shader="additive" disable-z-write="Y"/>
- <material name="stktex_purpleNebula_a.png" shader="additive" disable-z-write="Y"/>
- <material name="stktex_blueNebula_b.png" shader="additive" disable-z-write="Y"/>
- <material name="stktex_nebulaCloud_a.png" shader="additive" disable-z-write="Y"/>
- <material name="stktex_yellowNebulaCloud_a.png" shader="additive" disable-z-write="Y"/>
- <material name="stktex_yellowNebula_a.png" shader="additive" disable-z-write="Y"/>
-
- <material name="stktex_hayFiber_a.png" shader="grass" ignore="Y"/>
- <material name="stk_wheatA.png" shader="grass" ignore="Y"/>
-
-
- <material name="stktex_palmTreeBark_a.png" />
-
- <material name="bumpy_surface.png">
- <particles base="smoke.xml" condition="skid" />
- </material>
-
- <material name="brick.png">
- <particles base="smoke_yellow.xml" condition="skid drive" />
- </material>
-
- <material name="butterfly.png" shader="alphatest" light="N" clampU="Y" clampV="Y" ignore="Y"/>
-
-
- <material name="chess.png">
- <particles base="smoke.xml" condition="skid" />
- </material>
-
- <material name="city_asphalt_1.jpg" anisotropic="Y">
- <particles base="smoke.xml" condition="skid" />
- </material>
-
- <material name="city_checker.png">
- <particles base="smoke.xml" condition="skid" />
- </material>
-
-
- <material name="chrome.png" light="N" sphere="Y"/>
- <material name="chrome2.png" light="N" sphere="Y"/>
- <material name="clouds.png" light="N" reset="Y" ignore="Y"/>
- <material name="coniferous_tree.jpg" mask="coniferous_tree_alpha.jpg" compositing="coverage" light="N" ignore="Y"/>
- <material name="dirt2sand.png" anisotropic="Y"/>
-
- <material name="earth.png" slowdown-time="4" max-speed="0.5">
- <particles base="smoke_brown.xml" condition="skid drive" />
- </material>
-
- <material name="explode.png" compositing="additive" clampU="Y" clampV="Y" ignore="Y"/>
-
- <material name="generickartshadow.png" shader="alphatest" clampU="Y" clampV="Y" light="N" ignore="Y"/>
- <material name="grass2.jpg" max-speed="0.4" slowdown-time="2.0" anisotropic="Y"/>ice
- <material name="grass2dirt.png" clampU="Y" clampV="N" anisotropic="Y" />
- <material name="greenice.png" >
- <particles base="smoke.xml" condition="skid" />
- </material>ice
-
- <material name="hacienda_ground.jpg">
- <particles base="smoke.xml" condition="skid" />
- </material>
-
- <material name="HortonRockWall.jpg" anisotropic="Y" />
- <material name="HortonRockWall2.jpg" anisotropic="Y" />
- <material name="HortonStone6.jpg" anisotropic="Y" />
-
- <material name="ice.png">
- <particles base="smoke.xml" condition="skid" />
- </material>
-
- <material name="lava.png" light="N" reset="Y"/>
- <material name="logs.png" />
- <material name="metal_plates.png" anisotropic="Y" />
- <material name="notes.png" shader="alphatest" light="N" ignore="Y"/>
- <material name="oakleaf_fall.png" shader="alphatest" ignore="Y" light="N" />
- <material name="palmtree3.jpg" shader="alphatest" mask="palmtree3_alpha.jpg" />
- <material name="palm_b.png" shader="alphatest"/>
-
- <material name="Paving_stones_2.jpg" anisotropic="Y">
- <particles base="smoke_brown.xml" condition="skid" />
- </material>
-
- <material name="pino.png" shader="alphablend" />
- <material name="pino2.png" shader="alphablend" />
- <material name="pyramidwall.jpg" />
-
- <material name="rain.png" shader="alphablend" light="N" anisotropic="Y" />
-
- <material name="roadway.png" clampU="Y" anisotropic="Y">
- <particles base="smoke.xml" condition="skid" />
- </material>
-
- <material name="road_dirt.jpg" anisotropic="Y">
- <particles base="smoke_brown.xml" condition="skid" />
- </material>
-
- <material name="rock.jpg"/>
-
- <material name="sand.png" max-speed="0.4" slowdown-time="1.8">
- <particles base="smoke_yellow.xml" condition="skid drive" />
- </material>
-
- <material name="sandgrass.png" anisotropic="Y">
- <particles base="smoke_yellow.xml" condition="skid drive" />
- </material>
-
- <material name="sand2.jpg" max-speed="0.5" slowdown-time="3.0">
- <particles base="smoke_yellow.xml" condition="skid drive" />
- </material>
-
- <material name="sea.jpg" light="N" reset="Y"/>
- <material name="signs.png" shader="alphatest" light="N"/>
-
- <material name="slipstream.png" shader="additive" ignore="Y"/>
-
- <material name="snow.png" max-speed="0.4" slowdown-time="0.8">
- <particles base="smoke.xml" condition="skid drive" />
- </material>
-
- <material name="snowyroad.png">
- <particles base="smoke.xml" condition="skid drive" />
- </material>
-
- <material name="snowyrock.png"/>
- <material name="speedback.png" shader="alphatest" clampU="Y" clampV="Y" light="N" ignore="Y"/>
- <material name="speedfore.png" shader="alphatest" clampU="Y" clampV="Y" light="N" ignore="Y"/>
- <material name="starparticle.png" disable-z-write="Y" shader="alphablend" clampU="Y" clampV="Y" ignore="Y" light="N"/>
- <material name="stonetex.jpg" />
-
- <material name="track.png" anisotropic="Y">
- <particles base="smoke.xml" condition="skid" />
- </material>
-
- <material name="track2.jpg" anisotropic="Y">
- <particles base="smoke.xml" condition="skid" />
- </material>
-
- <material name="transparence.png" shader="alphatest" />
- <material name="unlit.png" shader="unlit"/>
- <material name="water_light.png" light="N" reset="Y"/>
- <material name="water-splash.png" shader="alphablend" light="N" ignore="Y"/>
-
- <material name="wood_planks1_alpha.png" shader="alphablend"/>
-
- <material name="yellow_dirt.jpg" max-speed="0.4" slowdown-time="2.0" anisotropic="Y">
- <particles base="smoke_yellow.xml" condition="skid drive" />
- </material>
-
</materials>

View File

@ -53,8 +53,6 @@ endif()
set(IRRLICHT_SOURCES
source/Irrlicht/CAndroidAssetFileArchive.cpp
source/Irrlicht/CAndroidAssetReader.cpp
source/Irrlicht/CAnimatedMeshSceneNode.cpp
source/Irrlicht/CAttributes.cpp
source/Irrlicht/CB3DMeshFileLoader.cpp
@ -106,7 +104,6 @@ source/Irrlicht/CImageLoaderPNG.cpp
source/Irrlicht/CImageWriterBMP.cpp
source/Irrlicht/CImageWriterJPG.cpp
source/Irrlicht/CImageWriterPNG.cpp
source/Irrlicht/CIrrDeviceAndroid.cpp
source/Irrlicht/CIrrDeviceConsole.cpp
source/Irrlicht/CIrrDeviceFB.cpp
source/Irrlicht/CIrrDeviceLinux.cpp
@ -186,8 +183,6 @@ source/Irrlicht/Irrlicht.cpp
source/Irrlicht/irrXML.cpp
source/Irrlicht/os.cpp
source/Irrlicht/BuiltInFont.h
source/Irrlicht/CAndroidAssetFileArchive.h
source/Irrlicht/CAndroidAssetReader.h
source/Irrlicht/CAnimatedMeshSceneNode.h
source/Irrlicht/CAttributeImpl.h
source/Irrlicht/CAttributes.h
@ -241,7 +236,6 @@ source/Irrlicht/CImageLoaderPNG.h
source/Irrlicht/CImageWriterBMP.h
source/Irrlicht/CImageWriterJPG.h
source/Irrlicht/CImageWriterPNG.h
source/Irrlicht/CIrrDeviceAndroid.h
source/Irrlicht/CIrrDeviceConsole.h
source/Irrlicht/CIrrDeviceFB.h
source/Irrlicht/CIrrDeviceLinux.h

View File

@ -1,101 +0,0 @@
// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "IrrCompileConfig.h"
#ifdef _IRR_COMPILE_ANDROID_ASSET_READER_
#include "CAndroidAssetReader.h"
#include "CReadFile.h"
#include "coreutil.h"
#include "CAndroidAssetFileArchive.h"
#include "CIrrDeviceAndroid.h"
#include <android_native_app_glue.h>
#include <android/native_activity.h>
#include <android/log.h>
namespace irr
{
namespace io
{
CAndroidAssetFileArchive *createAndroidAssetFileArchive(bool ignoreCase, bool ignorePaths)
{
if(!CIrrDeviceAndroid::getAndroidApp())
return NULL;
return new CAndroidAssetFileArchive(ignoreCase, ignorePaths);
}
CAndroidAssetFileArchive::CAndroidAssetFileArchive(bool ignoreCase, bool ignorePaths)
: CFileList("/asset", ignoreCase, ignorePaths)
{
AssetManager = CIrrDeviceAndroid::getAndroidApp()->activity->assetManager;
addDirectory("");
}
CAndroidAssetFileArchive::~CAndroidAssetFileArchive()
{
}
//! get the archive type
E_FILE_ARCHIVE_TYPE CAndroidAssetFileArchive::getType() const
{
return EFAT_ANDROID_ASSET;
}
const IFileList* CAndroidAssetFileArchive::getFileList() const
{
// The assert_manager can not read directory names, so
// for now getFileList does not work as expected.
return this; // Keep the compiler happy
}
//! opens a file by file name
IReadFile* CAndroidAssetFileArchive::createAndOpenFile(const io::path& filename)
{
CAndroidAssetReader *reader = new CAndroidAssetReader(filename);
if(reader->isOpen())
return reader;
reader->drop();
return NULL;
}
//! opens a file by index
IReadFile* CAndroidAssetFileArchive::createAndOpenFile(u32 index)
{
// Since we can't list files, not much sense in giving them an index
}
void CAndroidAssetFileArchive::addDirectory(const io::path &dirname)
{
AAssetDir *dir = AAssetManager_openDir(AssetManager, core::stringc(dirname).c_str());
if(!dir)
return;
addItem(dirname, 0, 0, /*isDir*/true, getFileCount());
while(const char *filename = AAssetDir_getNextFileName(dir))
{
core::stringc full_filename= dirname=="" ? filename
: dirname+"/"+filename;
// We can't get the size without opening the file - so for performance
// reasons we set the file size to 0.
addItem(full_filename, /*offet*/0, /*size*/0, /*isDir*/false,
getFileCount());
}
}
} // end namespace io
} // end namespace irr
#endif // _IRR_COMPILE_ANDROID_ASSET_READER_

View File

@ -1,70 +0,0 @@
// Copyright (C) 2012 Joerg Henrichs
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_ANDROID_ASSET_FILE_ARCHIVE_H_INCLUDED__
#define __C_ANDROID_ASSET_FILE_ARCHIVE_H_INCLUDED__
#include "IrrCompileConfig.h"
#ifdef _IRR_COMPILE_ANDROID_ASSET_READER_
#include "IReadFile.h"
#include "IFileArchive.h"
#include "CFileList.h"
#include <android/native_activity.h>
namespace irr
{
namespace io
{
/*!
Android asset file system written August 2012 by J.Henrichs
*/
class CAndroidAssetFileArchive : public virtual IFileArchive,
virtual CFileList
{
public:
//! constructor
CAndroidAssetFileArchive(bool ignoreCase, bool ignorePaths);
//! destructor
virtual ~CAndroidAssetFileArchive();
//! opens a file by file name
virtual IReadFile* createAndOpenFile(const io::path& filename);
//! opens a file by index
virtual IReadFile* createAndOpenFile(u32 index);
//! returns the list of files
virtual const IFileList* getFileList() const;
//! get the archive type
virtual E_FILE_ARCHIVE_TYPE getType() const;
//! Add a directory to read files from. Since the Android
//! API does not return names of directories, they need to
//! be added manually.
virtual void addDirectory(const io::path &filename);
protected:
//! Android's asset manager - keep a copy here
AAssetManager *AssetManager;
}; // CAndroidAssetFileArchive
CAndroidAssetFileArchive *createAndroidAssetFileArchive(bool ignoreCase=false,
bool ignorePaths=false);
} // end namespace io
} // end namespace irr
#endif // _IRR_COMPILE_ANDROID_ASSET_READER_
#endif // __C_ANDROID_ASSET_READER_H_INCLUDED__

View File

@ -1,73 +0,0 @@
// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "IrrCompileConfig.h"
#ifdef _IRR_COMPILE_ANDROID_ASSET_READER_
#include "CAndroidAssetReader.h"
#include "CReadFile.h"
#include "coreutil.h"
#include "CAndroidAssetReader.h"
#include "CIrrDeviceAndroid.h"
#include <android_native_app_glue.h>
#include <android/native_activity.h>
#include <android/log.h>
namespace irr
{
namespace io
{
CAndroidAssetReader::CAndroidAssetReader(const io::path &filename)
{
__android_log_print(ANDROID_LOG_VERBOSE, "native-activity", "path %s", core::stringc(filename).c_str());
AssetManager = CIrrDeviceAndroid::getAndroidApp()->activity->assetManager;
Asset = AAssetManager_open(AssetManager,
core::stringc(filename).c_str(),
AASSET_MODE_RANDOM);
Filename = filename;
}
CAndroidAssetReader::~CAndroidAssetReader()
{
if(Asset)
AAsset_close(Asset);
}
s32 CAndroidAssetReader::read(void* buffer, u32 sizeToRead)
{
return AAsset_read(Asset, buffer, sizeToRead);
}
bool CAndroidAssetReader::seek(long finalPos, bool relativeMovement)
{
long off = AAsset_seek(Asset, finalPos, relativeMovement ? SEEK_CUR
: SEEK_SET);
return off = relativeMovement-1;
}
long CAndroidAssetReader::getSize() const
{
return AAsset_getLength(Asset);
}
long CAndroidAssetReader::getPos() const
{
return AAsset_getLength(Asset) - AAsset_getRemainingLength(Asset);
}
const io::path& CAndroidAssetReader::getFileName() const
{
return Filename;
}
} // end namespace io
} // end namespace irr
#endif // _IRR_COMPILE_ANDROID_ASSET_READER_

View File

@ -1,74 +0,0 @@
// Copyright (C) 2012 Joerg Henrichs
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_ANDROID_ASSET_READER_H_INCLUDED__
#define __C_ANDROID_ASSET_READER_H_INCLUDED__
#include "IrrCompileConfig.h"
#ifdef _IRR_COMPILE_ANDROID_ASSET_READER_
#include "IReadFile.h"
struct AAssetManager;
struct AAsset;
namespace irr
{
namespace io
{
class CAndroidAssetReader : public virtual IReadFile
{
public:
CAndroidAssetReader(const io::path &filename);
virtual ~CAndroidAssetReader();
//! Reads an amount of bytes from the file.
/** \param buffer Pointer to buffer where read bytes are written to.
\param sizeToRead Amount of bytes to read from the file.
\return How many bytes were read. */
virtual s32 read(void* buffer, u32 sizeToRead);
//! Changes position in file
/** \param finalPos Destination position in the file.
\param relativeMovement If set to true, the position in the file is
changed relative to current position. Otherwise the position is changed
from beginning of file.
\return True if successful, otherwise false. */
virtual bool seek(long finalPos, bool relativeMovement = false);
//! Get size of file.
/** \return Size of the file in bytes. */
virtual long getSize() const;
//! Get the current position in the file.
/** \return Current position in the file in bytes. */
virtual long getPos() const;
//! Get name of file.
/** \return File name as zero terminated character string. */
virtual const io::path& getFileName() const;
/** Return true if the file could be opened. */
bool isOpen() const { return Asset!=NULL; }
protected:
//! Android's asset manager - keep a copy here
AAssetManager *AssetManager;
// An asset, i.e. file
AAsset *Asset;
path Filename;
};
} // end namespace io
} // end namespace irr
#endif // _IRR_COMPILE_ANDROID_ASSET_READER_
#endif // __C_ANDROID_ASSET_READER_H_INCLUDED__

View File

@ -1,452 +0,0 @@
// Copyright (C) 2002-2007 Nikolaus Gebhardt
// Copyright (C) 2007-2011 Christian Stehno
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "CIrrDeviceAndroid.h"
#ifdef _IRR_COMPILE_WITH_ANDROID_DEVICE_
#include <assert.h>
#include "os.h"
#include "CFileSystem.h"
#include "CAndroidAssetFileArchive.h"
namespace irr
{
namespace video
{
IVideoDriver* createOGLES1Driver(const SIrrlichtCreationParameters& params,
video::SExposedVideoData& data, io::IFileSystem* io);
IVideoDriver* createOGLES2Driver(const SIrrlichtCreationParameters& params,
video::SExposedVideoData& data, io::IFileSystem* io);
}
}
namespace irr
{
android_app* CIrrDeviceAndroid::Android = NULL;
#include <android/log.h>
//! constructor
CIrrDeviceAndroid::CIrrDeviceAndroid(const SIrrlichtCreationParameters& param)
: CIrrDeviceStub(param),
Animating(false),
IsReady(false),
IsClosing(false),
DeviceWidth(param.WindowSize.Width),
DeviceHeight(param.WindowSize.Height),
MouseX(0),
MouseY(0)
{
int ident;
int events;
struct android_poll_source* source;
#ifdef _DEBUG
setDebugName("CIrrDeviceAndroid");
#endif
// Get the interface to the native Android activity.
Android = (android_app *)(param.PrivateData);
// Set the private data so we can use it in any static callbacks.
Android->userData = this;
// Set the default command handler. This is a callback function
// that the Android OS invokes to send the native activity
// messages.
Android->onAppCmd = handleAndroidCommand;
// Create a sensor manager to recieve touch screen events from the
// java acivity.
SensorManager = ASensorManager_getInstance();
SensorEventQueue = ASensorManager_createEventQueue(
SensorManager, Android->looper,
LOOPER_ID_USER, NULL, NULL);
Android->onInputEvent = handleInput;
// Need to find a better way of doing this... but poll until the
// Android activity has been created and a window is open. The device
// cannot be created until the main window has been created by the
// Android OS.
os::Printer::log("Waiting for Android activity window to be created.", ELL_DEBUG);
if(Android->window == NULL) {
do
{
while( (ident = ALooper_pollAll( 0, NULL, &events,(void**)&source)) >= 0 )
{
// Process this event.
if( source != NULL )
{
source->process( Android, source );
}
}
}
while( IsReady == false );
}
os::Printer::log("Done", ELL_DEBUG);
assert( Android->window );
// Create cursor control
CursorControl = new CCursorControl(this);
io::CAndroidAssetFileArchive *assets = io::createAndroidAssetFileArchive(false, false);
assets->addDirectory("media");
FileSystem->addFileArchive(assets);
// Create the driver.
createDriver();
if (VideoDriver)
createGUIAndScene();
// TODO
//
// if engine->app->savedState is not NULL then use postEventFromUser()
// with a custom android event so the user can use their own event
// receiver in order to load the apps previous state.
// The message should have a pointer to be filled and a size variable
// of how much data has been saved. Android free's this data later so
// there's no need to free it manually.
Animating = true;
}
CIrrDeviceAndroid::~CIrrDeviceAndroid(void)
{
}
void CIrrDeviceAndroid::createDriver( void )
{
video::SExposedVideoData data;
// Create the driver.
switch(CreationParams.DriverType)
{
case video::EDT_OGLES1:
#ifdef _IRR_COMPILE_WITH_OGLES1_
VideoDriver = video::createOGLES1Driver(CreationParams, data, FileSystem);
#else
os::Printer::log("No OpenGL ES 1.0 support compiled in.", ELL_ERROR);
#endif
break;
case video::EDT_OGLES2:
#ifdef _IRR_COMPILE_WITH_OGLES2_
VideoDriver = video::createOGLES2Driver(CreationParams, data, FileSystem);
#else
os::Printer::log("No OpenGL ES 2.0 support compiled in.", ELL_ERROR);
#endif
break;
case video::EDT_NULL:
VideoDriver = video::createNullDriver(FileSystem, CreationParams.WindowSize);
break;
default:
os::Printer::log("Unable to create video driver of unknown type.", ELL_ERROR);
break;
}
}
bool CIrrDeviceAndroid::run( void )
{
bool close = false;
// Read all pending events.
int ident;
int events;
struct android_poll_source* source;
// Check if Android is trying to shut us down.
if( IsClosing == true )
return( false );
// If not animating, we will block forever waiting for events.
// If animating, we loop until all events are read, then continue
// to draw the next frame of animation.
#if 0
while( ( ident = ALooper_pollAll( ( Animating || IsClosing ) ? 0 : -1,
NULL, &events,
(void**)&source)) >= 0 )
{
// Process this event.
if( source != NULL )
{
source->process( Android, source );
}
// If a sensor has data, process it now.
if (ident == LOOPER_ID_USER) {
if (engine.accelerometerSensor != NULL) {
ASensorEvent event;
while (ASensorEventQueue_getEvents(engine.sensorEventQueue,
&event, 1) > 0) {
DEBUG_INFO1("accelerometer: x=%f y=%f z=%f",
event.acceleration.x, event.acceleration.y,
event.acceleration.z);
}
}
}
// Check if we are exiting.
if( Android->destroyRequested != 0 )
{
close = true;
}
}
#endif
os::Timer::tick();
return( !close );
}
void CIrrDeviceAndroid::yield( void )
{
}
void CIrrDeviceAndroid::sleep( u32 timeMs, bool pauseTimer )
{
}
void CIrrDeviceAndroid::setWindowCaption(const wchar_t* text)
{
}
bool CIrrDeviceAndroid::present(video::IImage* surface, void* windowId, core::rect<s32>* srcClip)
{
return( true );
}
bool CIrrDeviceAndroid::isWindowActive( void ) const
{
return( true );
}
bool CIrrDeviceAndroid::isWindowFocused( void ) const
{
return( false );
}
bool CIrrDeviceAndroid::isWindowMinimized( void ) const
{
return( false );
}
void CIrrDeviceAndroid::closeDevice( void )
{
}
void CIrrDeviceAndroid::setResizable( bool resize )
{
}
void CIrrDeviceAndroid::minimizeWindow( void )
{
}
void CIrrDeviceAndroid::maximizeWindow( void )
{
}
void CIrrDeviceAndroid::restoreWindow( void )
{
}
E_DEVICE_TYPE CIrrDeviceAndroid::getType( void ) const
{
return( EIDT_ANDROID );
}
///////////////////////////////
///////////////////////////////
void CIrrDeviceAndroid::handleAndroidCommand( struct android_app* app, s32 cmd )
{
CIrrDeviceAndroid *deviceAndroid = (CIrrDeviceAndroid *)app->userData;
switch (cmd)
{
case APP_CMD_SAVE_STATE:
os::Printer::log("Android command APP_CMD_SAVE_STATE", ELL_DEBUG);
// TODO
//
// use postEventFromUser() with a custom android event so the user can
// use their own event receiver in order to save the apps state.
// The message should have a pointer to be filled and a size variable
// of ho emuch data has been saved.
#if 0
// The system has asked us to save our current state. Do so.
engine->app->savedState = malloc(sizeof(struct saved_state));
*((struct saved_state*)engine->app->savedState) = engine->state;
engine->app->savedStateSize = sizeof(struct saved_state);
#endif
break;
case APP_CMD_INIT_WINDOW:
os::Printer::log("Android command APP_CMD_INIT_WINDOW", ELL_DEBUG);
deviceAndroid->IsReady = true;
break;
case APP_CMD_TERM_WINDOW:
os::Printer::log("Android command APP_CMD_TERM_WINDOW", ELL_DEBUG);
break;
case APP_CMD_GAINED_FOCUS:
os::Printer::log("Android command APP_CMD_GAINED_FOCUS", ELL_DEBUG);
#if 0
// When our app gains focus, we start monitoring the accelerometer.
if (engine->accelerometerSensor != NULL) {
ASensorEventQueue_enableSensor(engine->sensorEventQueue,
engine->accelerometerSensor);
// We'd like to get 60 events per second (in us).
ASensorEventQueue_setEventRate(engine->sensorEventQueue,
engine->accelerometerSensor, (1000L/60)*1000);
}
#endif
deviceAndroid->Animating = true;
break;
case APP_CMD_LOST_FOCUS:
os::Printer::log("Android command APP_CMD_LOST_FOCUS", ELL_DEBUG);
// When our app loses focus, we stop monitoring the accelerometer.
// This is to avoid consuming battery while not being used.
#if 0
if (engine->accelerometerSensor != NULL) {
ASensorEventQueue_disableSensor(engine->sensorEventQueue,
engine->accelerometerSensor);
}
#endif
// Also stop animating.
deviceAndroid->Animating = false;
break;
case APP_CMD_DESTROY:
// The application is being destroyed. We must close the native
// acitivity code and clean up otherwise the acitivity will stay
// active.
os::Printer::log("Android command APP_CMD_DESTROY", ELL_DEBUG);
deviceAndroid->IsClosing = true;
break;
case APP_CMD_PAUSE:
os::Printer::log("Android command APP_CMD_PAUSE", ELL_DEBUG);
break;
case APP_CMD_STOP:
os::Printer::log("Android command APP_CMD_STOP", ELL_DEBUG);
break;
case APP_CMD_RESUME:
os::Printer::log("Android command APP_CMD_RESUME", ELL_DEBUG);
break;
default:
os::Printer::log("Unhandled android command",
core::stringc(cmd).c_str(), ELL_WARNING );
}
}
s32 CIrrDeviceAndroid::handleInput( struct android_app* app, AInputEvent* androidEvent )
{
CIrrDeviceAndroid *deviceAndroid = (CIrrDeviceAndroid *)app->userData;
int32_t eventAction;
int pointerCount = 0;
SEvent irrEvent;
int i = 0;
if( AInputEvent_getType( androidEvent ) == AINPUT_EVENT_TYPE_MOTION )
{
// Get the number of pointers.
pointerCount = AMotionEvent_getPointerCount( androidEvent );
// Get the actual input event type.
eventAction = AMotionEvent_getAction( androidEvent );
switch( eventAction )
{
case AMOTION_EVENT_ACTION_DOWN:
if( pointerCount == 1 )
{
irrEvent.EventType = EET_MOUSE_INPUT_EVENT;
irrEvent.MouseInput.Event = EMIE_LMOUSE_PRESSED_DOWN;
}
break;
case AMOTION_EVENT_ACTION_MOVE:
if( pointerCount == 1 )
{
irrEvent.EventType = EET_MOUSE_INPUT_EVENT;
irrEvent.MouseInput.Event = EMIE_MOUSE_MOVED;
}
else
{
irrEvent.EventType = EET_MULTI_TOUCH_EVENT;
irrEvent.MultiTouchInput.Event = EMTIE_MOVED;
}
deviceAndroid->postEventFromUser(irrEvent);
break;
case AMOTION_EVENT_ACTION_UP:
if( pointerCount == 1 )
{
irrEvent.EventType = EET_MOUSE_INPUT_EVENT;
irrEvent.MouseInput.Event = EMIE_LMOUSE_LEFT_UP;
}
break;
default:
os::Printer::log("Unhandled motion event",
core::stringc(eventAction).c_str(),
ELL_WARNING );
}
if( pointerCount == 1 )
{
// Fill in the details for a one touch event.
deviceAndroid->MouseX = irrEvent.MouseInput.X = AMotionEvent_getX(androidEvent, 0);
deviceAndroid->MouseY = irrEvent.MouseInput.Y = AMotionEvent_getY(androidEvent, 0);
irrEvent.MouseInput.ButtonStates = 0;
}
else if( pointerCount > 1 )
{
// Fill in the details for a multi touch event.
for( i=0 ; i<pointerCount ; i++ )
{
irrEvent.MultiTouchInput.Touched[i] = 1;
irrEvent.MultiTouchInput.PrevX[i] = irrEvent.MultiTouchInput.X[i];
irrEvent.MultiTouchInput.PrevY[i] = irrEvent.MultiTouchInput.Y[i];
irrEvent.MultiTouchInput.X[i] = AMotionEvent_getX(androidEvent, i);
irrEvent.MultiTouchInput.Y[i] = AMotionEvent_getY(androidEvent, i);
}
// Reset the data for the rest of the pointers that aren't being used.
for( ;i<NUMBER_OF_MULTI_TOUCHES ; i++ )
{
irrEvent.MultiTouchInput.Touched[i] = 0;
irrEvent.MultiTouchInput.PrevX[i] = 0;
irrEvent.MultiTouchInput.PrevY[i] = 0;
irrEvent.MultiTouchInput.X[i] = 0;
irrEvent.MultiTouchInput.Y[i] = 0;
}
}
else
{
// Shouldn't ever get here, but just in case...
os::Printer::log("We had a input event but no pointers were active!", ELL_DEBUG);
return( 0 );
}
deviceAndroid->postEventFromUser(irrEvent);
return( 1 );
}
return( 0 );
}
} // end namespace irr
#endif

View File

@ -1,157 +0,0 @@
// Copyright (C) 2002-2011 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_IRR_DEVICE_ANDROID_H_INCLUDED__
#define __C_IRR_DEVICE_ANDROID_H_INCLUDED__
#include "IrrCompileConfig.h"
#ifdef _IRR_COMPILE_WITH_ANDROID_DEVICE_
#include <android/sensor.h>
#include <android_native_app_glue.h>
#include "CIrrDeviceStub.h"
#include "IrrlichtDevice.h"
#include "IImagePresenter.h"
#include "ICursorControl.h"
namespace irr
{
class CIrrDeviceAndroid : public CIrrDeviceStub, video::IImagePresenter
{
public:
//! constructor
CIrrDeviceAndroid(const SIrrlichtCreationParameters& param);
//! destructor
virtual ~CIrrDeviceAndroid();
virtual bool run( void );
virtual void yield( void );
virtual void sleep( u32 timeMs, bool pauseTimer=false );
virtual void setWindowCaption(const wchar_t* text);
virtual bool present(video::IImage* surface, void* windowId, core::rect<s32>* srcClip) ;
virtual bool isWindowActive( void ) const;
virtual bool isWindowFocused( void ) const;
virtual bool isWindowMinimized( void ) const;
virtual void closeDevice( void );
virtual void setResizable( bool resize=false );
virtual void minimizeWindow( void );
virtual void maximizeWindow( void );
virtual void restoreWindow( void );
virtual E_DEVICE_TYPE getType( void ) const;
//! Implementation of the linux cursor control
class CCursorControl : public gui::ICursorControl
{
public:
CCursorControl(CIrrDeviceAndroid* dev)
: Device(dev), IsVisible(true)
{
}
//! Changes the visible state of the mouse cursor.
virtual void setVisible(bool visible)
{
IsVisible = visible;
//if ( visible )
// SDL_ShowCursor( SDL_ENABLE );
//else
// SDL_ShowCursor( SDL_DISABLE );
}
//! Returns if the cursor is currently visible.
virtual bool isVisible() const
{
return IsVisible;
}
//! Sets the new position of the cursor.
virtual void setPosition(const core::position2d<f32> &pos)
{
setPosition(pos.X, pos.Y);
}
//! Sets the new position of the cursor.
virtual void setPosition(f32 x, f32 y)
{
setPosition((s32)(x*Device->DeviceWidth), (s32)(y*Device->DeviceHeight));
}
//! Sets the new position of the cursor.
virtual void setPosition(const core::position2d<s32> &pos)
{
setPosition(pos.X, pos.Y);
}
//! Sets the new position of the cursor.
virtual void setPosition(s32 x, s32 y)
{
//SDL_WarpMouse( x, y );
}
//! Returns the current position of the mouse cursor.
virtual const core::position2d<s32>& getPosition()
{
updateCursorPos();
return CursorPos;
}
//! Returns the current position of the mouse cursor.
virtual core::position2d<f32> getRelativePosition()
{
updateCursorPos();
return core::position2d<f32>(CursorPos.X / (f32)Device->DeviceWidth,
CursorPos.Y / (f32)Device->DeviceHeight);
}
virtual void setReferenceRect(core::rect<s32>* rect=0)
{
}
private:
void updateCursorPos()
{
CursorPos.X = Device->MouseX;
CursorPos.Y = Device->MouseY;
if (CursorPos.X < 0)
CursorPos.X = 0;
if (CursorPos.X > (s32)Device->DeviceWidth)
CursorPos.X = Device->DeviceWidth;
if (CursorPos.Y < 0)
CursorPos.Y = 0;
if (CursorPos.Y > (s32)Device->DeviceHeight)
CursorPos.Y = Device->DeviceHeight;
}
CIrrDeviceAndroid* Device;
core::position2d<s32> CursorPos;
bool IsVisible;
};
static android_app *getAndroidApp() { return Android; }
private:
static android_app *Android;
ASensorManager *SensorManager;
ASensorEventQueue *SensorEventQueue;
bool Animating;
bool IsReady;
bool IsClosing;
u32 DeviceWidth, DeviceHeight;
u32 MouseX, MouseY;
void createDriver( void );
static void handleAndroidCommand( struct android_app* app, s32 cmd );
static s32 handleInput( struct android_app* app, AInputEvent* event );
};
} // end namespace irr
#endif // _IRR_COMPILE_WITH_ANDROID_DEVICE_
#endif // __C_IRR_DEVICE_ANDROID_H_INCLUDED__