Added two new config options to ChangeAppSettings.sh - disable depth buffer in OpenGL renderer and enable auto screen resizing

This commit is contained in:
pelya
2010-06-10 18:49:59 +03:00
parent b12b52db57
commit 647d3eefa9
7 changed files with 45 additions and 4 deletions

View File

@@ -3,3 +3,5 @@ AppFullName=de.schwardtnet.alienblaster
ScreenOrientation=v
AppDataDownloadUrl="http://sites.google.com/site/xpelyax/Home/alienblaster110_data.zip?attredirects=0&d=1"
DownloadToSdcard=n
SdlVideoResize=y
NeedDepthBuffer=n

View File

@@ -33,12 +33,26 @@ if [ -n "$var" ] ; then
DownloadToSdcard="$var"
fi
echo -n "\nApplication window should be resized to fit into 480x320 screen ($SdlVideoResize): "
read var
if [ -n "$var" ] ; then
SdlVideoResize="$var"
fi
echo -n "\nEnable OpenGL depth buffer (needed only for 3-d applications) ($NeedDepthBuffer): "
read var
if [ -n "$var" ] ; then
NeedDepthBuffer="$var"
fi
cat /dev/null > AppSettings.cfg
echo AppName=\"$AppName\" >> AppSettings.cfg
echo AppFullName=$AppFullName >> AppSettings.cfg
echo ScreenOrientation=$ScreenOrientation >> AppSettings.cfg
echo AppDataDownloadUrl=\"$AppDataDownloadUrl\" >> AppSettings.cfg
echo DownloadToSdcard=$DownloadToSdcard >> AppSettings.cfg
echo SdlVideoResize=$SdlVideoResize >> AppSettings.cfg
echo NeedDepthBuffer=$NeedDepthBuffer >> AppSettings.cfg
AppShortName=`echo $AppName | sed 's/ //g'`
DataPath="/data/data/$AppFullName/files"
@@ -54,6 +68,16 @@ if [ "$ScreenOrientation" = "h" ] ; then
ScreenOrientation1=landscape
fi
AppDataDownloadUrl1="`echo $AppDataDownloadUrl | sed 's/[&]/%26/g'`"
if [ "$SdlVideoResize" = "y" ] ; then
SdlVideoResize=1
else
SdlVideoResize=0
fi
if [ "$NeedDepthBuffer" = "y" ] ; then
NeedDepthBuffer=true
else
NeedDepthBuffer=false
fi
echo Patching project/AndroidManifest.xml
cat project/AndroidManifest.xml | \
@@ -74,7 +98,8 @@ echo Patching project/src/Globals.java
cat project/src/Globals.java | \
sed "s/public static String ApplicationName = .*;/public static String ApplicationName = \"$AppShortName\";/" | \
sed "s^public static String DataDownloadUrl = \".*\";^public static String DataDownloadUrl = \"$AppDataDownloadUrl1\";^" | \
sed "s/public static boolean DownloadToSdcard = .*;/public static boolean DownloadToSdcard = $DownloadToSdcard1;/" > \
sed "s/public static boolean DownloadToSdcard = .*;/public static boolean DownloadToSdcard = $DownloadToSdcard1;/" | \
sed "s/public static boolean NeedDepthBuffer = .*;/public static boolean NeedDepthBuffer = $NeedDepthBuffer;/" > \
project/src/Globals.java.1
mv -f project/src/Globals.java.1 project/src/Globals.java
@@ -84,7 +109,8 @@ echo Patching project/jni/Android.mk
cat project/jni/Android.mk | \
sed "s/SDL_JAVA_PACKAGE_PATH := .*/SDL_JAVA_PACKAGE_PATH := $AppFullNameUnderscored/" | \
sed "s^SDL_CURDIR_PATH := .*^SDL_CURDIR_PATH := $DataPath^" > \
sed "s^SDL_CURDIR_PATH := .*^SDL_CURDIR_PATH := $DataPath^" | \
sed "s^SDL_VIDEO_RENDER_RESIZE := .*^SDL_VIDEO_RENDER_RESIZE := $SdlVideoResize^" > \
project/jni/Android.mk.1
mv -f project/jni/Android.mk.1 project/jni/Android.mk
@@ -94,9 +120,10 @@ cat project/res/values/strings.xml | \
project/res/values/strings.xml.1
mv -f project/res/values/strings.xml.1 project/res/values/strings.xml
# Force rebuild of C-Java bindings
# Force rebuild of C-Java bindings and updated settings
touch project/jni/sdl_main/*.c
touch project/jni/sdl/src/video/android/*.c
touch project/jni/sdl/src/video/*.c
touch project/jni/sdl/src/audio/android/*.c
rm -f project/libs/armeabi/libapplication.so project/libs/armeabi/libsdl.so project/libs/armeabi/libsdl_main.so

View File

@@ -19,4 +19,8 @@ SDL_CURDIR_PATH := /data/data/de.schwardtnet.alienblaster/files
# TODO: create a libsdl config file for that option and for key mapping/on-screen keyboard
SDL_TRACKBALL_KEYUP_DELAY := 1
# If the application designed for higher screen resolution enable this to get the screen
# resized in HW-accelerated way, however it eats a tiny bit of CPU
SDL_VIDEO_RENDER_RESIZE := 1
include $(call all-subdir-makefiles)

View File

@@ -12,6 +12,7 @@ LOCAL_CFLAGS := -I$(LOCAL_PATH)/include \
-DSDL_JAVA_PACKAGE_PATH=$(SDL_JAVA_PACKAGE_PATH) \
-DSDL_CURDIR_PATH=\"$(SDL_CURDIR_PATH)\" \
-DSDL_TRACKBALL_KEYUP_DELAY=$(SDL_TRACKBALL_KEYUP_DELAY) \
-DSDL_VIDEO_RENDER_RESIZE=$(SDL_VIDEO_RENDER_RESIZE)
SDL_SRCS := \

View File

@@ -34,7 +34,6 @@
#define SDL_VIDEO_DRIVER_ANDROID 1
#define SDL_VIDEO_OPENGL_ES 1
#define SDL_VIDEO_RENDER_OGL_ES 1
#define SDL_VIDEO_RENDER_RESIZE 1
#define SDL_AUDIO_DRIVER_ANDROID 1

View File

@@ -18,6 +18,9 @@ class Globals {
// set this dir in jni/Android.mk in SDL_CURDIR_PATH
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
public static boolean DownloadToSdcard = false;
// Set this value to true if you're planning to render 3D using OpenGL - it eats some GFX resources, so disabled for 2D
public static boolean NeedDepthBuffer = false;
}
class LoadLibrary {

View File

@@ -19,6 +19,7 @@ import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import java.lang.Thread;
class DemoRenderer extends GLSurfaceView_SDL.Renderer {
@@ -41,6 +42,9 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer {
nativeInitJavaCallbacks();
// Make main thread priority lower so audio thread won't get underrun
// Thread.currentThread().setPriority((Thread.currentThread().getPriority() + Thread.MIN_PRIORITY)/2);
System.loadLibrary("application");
System.loadLibrary("sdl_main");
@@ -76,6 +80,7 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
public DemoGLSurfaceView(Activity context) {
super(context);
mParent = context;
setEGLConfigChooser(Globals.NeedDepthBuffer);
accelerometer = new AccelerometerReader(context);
mRenderer = new DemoRenderer(context);
setRenderer(mRenderer);