Integrated Michi's changes to accelerometer joystick and to video aspect ratio

This commit is contained in:
pelya
2010-10-15 16:04:42 +03:00
parent ebaff58990
commit a8f3d8b6b7
19 changed files with 152 additions and 65 deletions

View File

@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
CHANGE_APP_SETTINGS_VERSION=10 CHANGE_APP_SETTINGS_VERSION=11
AUTO= AUTO=
if [ "X$1" = "X-a" ]; then if [ "X$1" = "X-a" ]; then
@@ -72,6 +72,13 @@ if [ -n "$var" ] ; then
SdlVideoResize="$var" SdlVideoResize="$var"
fi fi
echo -n "\nApplication resizing should preserve the aspect ratio, creating black bars (y) or (n) ($SdlVideoResizeKeepAspect): "
read var
if [ -n "$var" ] ; then
SdlVideoResizeKeepAspect="$var"
fi
echo -n "\nEnable OpenGL depth buffer (needed only for 3-d applications, small speed decrease) (y) or (n) ($NeedDepthBuffer): " echo -n "\nEnable OpenGL depth buffer (needed only for 3-d applications, small speed decrease) (y) or (n) ($NeedDepthBuffer): "
read var read var
if [ -n "$var" ] ; then if [ -n "$var" ] ; then
@@ -110,6 +117,13 @@ if [ -n "$var" ] ; then
NonBlockingSwapBuffers="$var" NonBlockingSwapBuffers="$var"
fi fi
echo -n "\nPrevent device from going to suspend mode while application is running (y/n) ($InhibitSuspend): "
read var
if [ -n "$var" ] ; then
InhibitSuspend="$var"
fi
echo -n "\nRedefine common keys to SDL keysyms: TOUCHSCREEN SEARCH/CALL/DPAD_CENTER VOLUMEUP VOLUMEDOWN MENU BACK CAMERA ENTER DEL" echo -n "\nRedefine common keys to SDL keysyms: TOUCHSCREEN SEARCH/CALL/DPAD_CENTER VOLUMEUP VOLUMEDOWN MENU BACK CAMERA ENTER DEL"
echo -n "\nMENU and BACK hardware keys and TOUCHSCREEN virtual 'key' are available on all devices, other keys may be absent" echo -n "\nMENU and BACK hardware keys and TOUCHSCREEN virtual 'key' are available on all devices, other keys may be absent"
echo -n "\nThe same key values are used if touchscreen keyboard is enabled, except for MENU and BACK\n($RedefinedKeys)\n: " echo -n "\nThe same key values are used if touchscreen keyboard is enabled, except for MENU and BACK\n($RedefinedKeys)\n: "
@@ -217,8 +231,10 @@ echo LibSdlVersion=$LibSdlVersion >> AndroidAppSettings.cfg
echo AppName=\"$AppName\" >> AndroidAppSettings.cfg echo AppName=\"$AppName\" >> AndroidAppSettings.cfg
echo AppFullName=$AppFullName >> AndroidAppSettings.cfg echo AppFullName=$AppFullName >> AndroidAppSettings.cfg
echo ScreenOrientation=$ScreenOrientation >> AndroidAppSettings.cfg echo ScreenOrientation=$ScreenOrientation >> AndroidAppSettings.cfg
echo InhibitSuspend=$InhibitSuspend >> AndroidAppSettings.cfg
echo AppDataDownloadUrl=\"$AppDataDownloadUrl\" >> AndroidAppSettings.cfg echo AppDataDownloadUrl=\"$AppDataDownloadUrl\" >> AndroidAppSettings.cfg
echo SdlVideoResize=$SdlVideoResize >> AndroidAppSettings.cfg echo SdlVideoResize=$SdlVideoResize >> AndroidAppSettings.cfg
echo SdlVideoResizeKeepAspect=$SdlVideoResizeKeepAspect >> AndroidAppSettings.cfg
echo NeedDepthBuffer=$NeedDepthBuffer >> AndroidAppSettings.cfg echo NeedDepthBuffer=$NeedDepthBuffer >> AndroidAppSettings.cfg
echo AppUsesMouse=$AppUsesMouse >> AndroidAppSettings.cfg echo AppUsesMouse=$AppUsesMouse >> AndroidAppSettings.cfg
echo AppNeedsArrowKeys=$AppNeedsArrowKeys >> AndroidAppSettings.cfg echo AppNeedsArrowKeys=$AppNeedsArrowKeys >> AndroidAppSettings.cfg
@@ -245,21 +261,38 @@ AppFullNameUnderscored=`echo $AppFullName | sed 's/[.]/_/g'`
AppSharedLibrariesPath=/data/data/$AppFullName/lib AppSharedLibrariesPath=/data/data/$AppFullName/lib
ScreenOrientation1=portrait ScreenOrientation1=portrait
HorizontalOrientation=false HorizontalOrientation=false
if [ "$ScreenOrientation" = "h" ] ; then if [ "$ScreenOrientation" = "h" ] ; then
ScreenOrientation1=landscape ScreenOrientation1=landscape
HorizontalOrientation=true HorizontalOrientation=true
fi fi
AppDataDownloadUrl1="`echo $AppDataDownloadUrl | sed 's/[&]/%26/g'`" AppDataDownloadUrl1="`echo $AppDataDownloadUrl | sed 's/[&]/%26/g'`"
if [ "$SdlVideoResize" = "y" ] ; then if [ "$SdlVideoResize" = "y" ] ; then
SdlVideoResize=1 SdlVideoResize=1
else else
SdlVideoResize=0 SdlVideoResize=0
fi fi
if [ "$SdlVideoResizeKeepAspect" = "y" ] ; then
SdlVideoResizeKeepAspect=1
else
SdlVideoResizeKeepAspect=0
fi
if [ "$InhibitSuspend" = "y" ] ; then
InhibitSuspend=true
else
InhibitSuspend=false
fi
if [ "$NeedDepthBuffer" = "y" ] ; then if [ "$NeedDepthBuffer" = "y" ] ; then
NeedDepthBuffer=true NeedDepthBuffer=true
else else
NeedDepthBuffer=false NeedDepthBuffer=false
fi fi
MouseKeycode=UNKNOWN MouseKeycode=UNKNOWN
if [ "$AppUsesMouse" = "y" ] ; then if [ "$AppUsesMouse" = "y" ] ; then
AppUsesMouse=true AppUsesMouse=true
@@ -269,16 +302,19 @@ else
MouseKeycode=$AppUsesMouse MouseKeycode=$AppUsesMouse
AppUsesMouse=false AppUsesMouse=false
fi fi
if [ "$AppNeedsArrowKeys" = "y" ] ; then if [ "$AppNeedsArrowKeys" = "y" ] ; then
AppNeedsArrowKeys=true AppNeedsArrowKeys=true
else else
AppNeedsArrowKeys=false AppNeedsArrowKeys=false
fi fi
if [ "$AppUsesJoystick" = "y" ] ; then if [ "$AppUsesJoystick" = "y" ] ; then
AppUsesJoystick=true AppUsesJoystick=true
else else
AppUsesJoystick=false AppUsesJoystick=false
fi fi
if [ "$AppUsesMultitouch" = "y" ] ; then if [ "$AppUsesMultitouch" = "y" ] ; then
AppUsesMultitouch=true AppUsesMultitouch=true
else else
@@ -337,6 +373,7 @@ cat project/src/Globals.java | \
sed "s@public static String DataDownloadUrl = .*@public static String DataDownloadUrl = \"$AppDataDownloadUrl1\";@" | \ sed "s@public static String DataDownloadUrl = .*@public static String DataDownloadUrl = \"$AppDataDownloadUrl1\";@" | \
sed "s/public static boolean NeedDepthBuffer = .*;/public static boolean NeedDepthBuffer = $NeedDepthBuffer;/" | \ sed "s/public static boolean NeedDepthBuffer = .*;/public static boolean NeedDepthBuffer = $NeedDepthBuffer;/" | \
sed "s/public static boolean HorizontalOrientation = .*;/public static boolean HorizontalOrientation = $HorizontalOrientation;/" | \ sed "s/public static boolean HorizontalOrientation = .*;/public static boolean HorizontalOrientation = $HorizontalOrientation;/" | \
sed "s/public static boolean InhibitSuspend = .*;/public static boolean InhibitSuspend = $InhibitSuspend;/" | \
sed "s/public static boolean AppUsesMouse = .*;/public static boolean AppUsesMouse = $AppUsesMouse;/" | \ sed "s/public static boolean AppUsesMouse = .*;/public static boolean AppUsesMouse = $AppUsesMouse;/" | \
sed "s/public static boolean AppNeedsArrowKeys = .*;/public static boolean AppNeedsArrowKeys = $AppNeedsArrowKeys;/" | \ sed "s/public static boolean AppNeedsArrowKeys = .*;/public static boolean AppNeedsArrowKeys = $AppNeedsArrowKeys;/" | \
sed "s/public static boolean AppUsesJoystick = .*;/public static boolean AppUsesJoystick = $AppUsesJoystick;/" | \ sed "s/public static boolean AppUsesJoystick = .*;/public static boolean AppUsesJoystick = $AppUsesJoystick;/" | \
@@ -354,6 +391,7 @@ cat project/jni/Android.mk | \
sed "s/SDL_JAVA_PACKAGE_PATH := .*/SDL_JAVA_PACKAGE_PATH := $AppFullNameUnderscored/" | \ 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^" | \ sed "s^SDL_VIDEO_RENDER_RESIZE := .*^SDL_VIDEO_RENDER_RESIZE := $SdlVideoResize^" | \
sed "s^SDL_VIDEO_RENDER_RESIZE_KEEP_ASPECT := .*^SDL_VIDEO_RENDER_RESIZE_KEEP_ASPECT := $SdlVideoResizeKeepAspect^" | \
sed "s^COMPILED_LIBRARIES := .*^COMPILED_LIBRARIES := $CompiledLibraries^" | \ sed "s^COMPILED_LIBRARIES := .*^COMPILED_LIBRARIES := $CompiledLibraries^" | \
sed "s^APPLICATION_ADDITIONAL_CFLAGS :=.*^APPLICATION_ADDITIONAL_CFLAGS := $AppCflags^" | \ sed "s^APPLICATION_ADDITIONAL_CFLAGS :=.*^APPLICATION_ADDITIONAL_CFLAGS := $AppCflags^" | \
sed "s^APPLICATION_ADDITIONAL_LDFLAGS :=.*^APPLICATION_ADDITIONAL_LDFLAGS := $AppLdflags^" | \ sed "s^APPLICATION_ADDITIONAL_LDFLAGS :=.*^APPLICATION_ADDITIONAL_LDFLAGS := $AppLdflags^" | \

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.schwardtnet.alienblaster" package="org.enigmagame.enigma"
android:versionCode="110011" android:versionCode="1"
android:versionName="1.1.0.11 - fixed keys stuck sometimes for on-screen keyboard, fixed restoring app from background" android:versionName="0.1"
android:installLocation="preferExternal" android:installLocation="preferExternal"
> >
<application android:label="@string/app_name" <application android:label="@string/app_name"

View File

@@ -1,6 +1,6 @@
# The namespace in Java file, with dots replaced with underscores # The namespace in Java file, with dots replaced with underscores
SDL_JAVA_PACKAGE_PATH := de_schwardtnet_alienblaster SDL_JAVA_PACKAGE_PATH := org_enigmagame_enigma
# Path to shared libraries - Android 1.6 cannot load them properly, thus we have to specify absolute path here # Path to shared libraries - Android 1.6 cannot load them properly, thus we have to specify absolute path here
# SDL_SHARED_LIBRARIES_PATH := /data/data/de.schwardtnet.alienblaster/lib # SDL_SHARED_LIBRARIES_PATH := /data/data/de.schwardtnet.alienblaster/lib
@@ -10,7 +10,7 @@ SDL_JAVA_PACKAGE_PATH := de_schwardtnet_alienblaster
# Typically /sdcard/alienblaster # Typically /sdcard/alienblaster
# Or /data/data/de.schwardtnet.alienblaster/files if you're planning to unpack data in application private folder # Or /data/data/de.schwardtnet.alienblaster/files if you're planning to unpack data in application private folder
# Your application will just set current directory there # Your application will just set current directory there
SDL_CURDIR_PATH := de.schwardtnet.alienblaster SDL_CURDIR_PATH := org.enigmagame.enigma
# Android Dev Phone G1 has trackball instead of cursor keys, and # Android Dev Phone G1 has trackball instead of cursor keys, and
# sends trackball movement events as rapid KeyDown/KeyUp events, # sends trackball movement events as rapid KeyDown/KeyUp events,
@@ -23,11 +23,13 @@ SDL_TRACKBALL_KEYUP_DELAY := 1
# resized in HW-accelerated way, however it eats a tiny bit of CPU # resized in HW-accelerated way, however it eats a tiny bit of CPU
SDL_VIDEO_RENDER_RESIZE := 1 SDL_VIDEO_RENDER_RESIZE := 1
COMPILED_LIBRARIES := sdl_mixer sdl_image SDL_VIDEO_RENDER_RESIZE_KEEP_ASPECT := 1
COMPILED_LIBRARIES := sdl_mixer sdl_image sdl_ttf intl lua
APPLICATION_ADDITIONAL_CFLAGS := -finline-functions -O2 APPLICATION_ADDITIONAL_CFLAGS := -finline-functions -O2
APPLICATION_ADDITIONAL_LDFLAGS := APPLICATION_ADDITIONAL_LDFLAGS := -lpng -lxerces
APPLICATION_SUBDIRS_BUILD := APPLICATION_SUBDIRS_BUILD :=
@@ -35,7 +37,7 @@ APPLICATION_CUSTOM_BUILD_SCRIPT :=
SDL_ADDITIONAL_CFLAGS := -DSDL_ANDROID_KEYCODE_MOUSE=UNKNOWN -DSDL_ANDROID_KEYCODE_0=RETURN -DSDL_ANDROID_KEYCODE_1=LCTRL -DSDL_ANDROID_KEYCODE_2=PAGEUP -DSDL_ANDROID_KEYCODE_3=PAGEDOWN -DSDL_ANDROID_KEYCODE_4=LCTRL SDL_ADDITIONAL_CFLAGS := -DSDL_ANDROID_KEYCODE_MOUSE=UNKNOWN -DSDL_ANDROID_KEYCODE_0=RETURN -DSDL_ANDROID_KEYCODE_1=LCTRL -DSDL_ANDROID_KEYCODE_2=PAGEUP -DSDL_ANDROID_KEYCODE_3=PAGEDOWN -DSDL_ANDROID_KEYCODE_4=LCTRL
SDL_VERSION := 1.3 SDL_VERSION := 1.2
# If SDL_Mixer should link to libMAD # If SDL_Mixer should link to libMAD
SDL_MIXER_USE_LIBMAD := SDL_MIXER_USE_LIBMAD :=

View File

@@ -6,6 +6,6 @@ APP_PROJECT_PATH := $(call my-dir)/..
# sdl_image depends on png and jpeg # sdl_image depends on png and jpeg
# sdl_ttf depends on freetype # sdl_ttf depends on freetype
APP_MODULES := application sdl-1.3 sdl_main stlport tremor png jpeg freetype xerces sdl_mixer sdl_image APP_MODULES := application sdl-1.2 sdl_main stlport tremor png jpeg freetype xerces sdl_mixer sdl_image sdl_ttf intl lua
APP_ABI := armeabi APP_ABI := armeabi

View File

@@ -6,6 +6,17 @@
IFS=' IFS='
' '
MYARCH=linux-x86
if uname -s | grep -i "linux" ; then
MYARCH=linux-x86
fi
if uname -s | grep -i "darwin" ; then
MYARCH=darwin-x86
fi
if uname -s | grep -i "windows" ; then
MYARCH=windows-x86
fi
NDK=`which ndk-build` NDK=`which ndk-build`
NDK=`dirname $NDK` NDK=`dirname $NDK`
GCCVER=4.4.0 GCCVER=4.4.0
@@ -17,14 +28,15 @@ LOCAL_PATH=`cd $LOCAL_PATH && pwd`
rm -rf $LOCAL_PATH/../../obj/local/armeabi/libSDL_*.so rm -rf $LOCAL_PATH/../../obj/local/armeabi/libSDL_*.so
rm -rf $LOCAL_PATH/../../obj/local/armeabi/libsdl_main.so rm -rf $LOCAL_PATH/../../obj/local/armeabi/libsdl_main.so
if [ -e $LOCAL_PATH/../../obj/local/armeabi/libsdl_mixer.so ] ; then # Uncomment if your configure expects SDL libraries in form "libSDL_name.so"
ln -sf libsdl_mixer.so $LOCAL_PATH/../../obj/local/armeabi/libSDL_Mixer.so #if [ -e $LOCAL_PATH/../../obj/local/armeabi/libsdl_mixer.so ] ; then
fi # ln -sf libsdl_mixer.so $LOCAL_PATH/../../obj/local/armeabi/libSDL_Mixer.so
#fi
for F in $LOCAL_PATH/../../obj/local/armeabi/libsdl_*.so; do #for F in $LOCAL_PATH/../../obj/local/armeabi/libsdl_*.so; do
LIBNAME=`echo $F | sed "s@$LOCAL_PATH/../../obj/local/armeabi/libsdl_\(.*\)[.]so@\1@"` # LIBNAME=`echo $F | sed "s@$LOCAL_PATH/../../obj/local/armeabi/libsdl_\(.*\)[.]so@\1@"`
ln -sf libsdl_$LIBNAME.so $LOCAL_PATH/../../obj/local/armeabi/libSDL_$LIBNAME.so # ln -sf libsdl_$LIBNAME.so $LOCAL_PATH/../../obj/local/armeabi/libSDL_$LIBNAME.so
done #done
CFLAGS="-I$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/include \ CFLAGS="-I$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/include \
-fpic -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums \ -fpic -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums \
@@ -36,8 +48,7 @@ CFLAGS="-I$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/include \
LDFLAGS="-nostdlib -Wl,-soname,libapplication.so -Wl,-shared,-Bsymbolic \ LDFLAGS="-nostdlib -Wl,-soname,libapplication.so -Wl,-shared,-Bsymbolic \
-Wl,--whole-archive -Wl,--no-whole-archive \ -Wl,--whole-archive -Wl,--no-whole-archive \
$LOCAL_PATH/../../obj/local/armeabi/libstlport.a \ $NDK/build/prebuilt/$MYARCH/arm-eabi-$GCCVER/lib/gcc/arm-eabi/4.4.0/libgcc.a \
$NDK/build/prebuilt/linux-x86/arm-eabi-$GCCVER/lib/gcc/arm-eabi/4.4.0/libgcc.a \
`echo $LOCAL_PATH/../../obj/local/armeabi/*.so | sed "s@$LOCAL_PATH/../../obj/local/armeabi/libsdl_main.so@@" | sed "s@$LOCAL_PATH/../../obj/local/armeabi/libapplication.so@@"` \ `echo $LOCAL_PATH/../../obj/local/armeabi/*.so | sed "s@$LOCAL_PATH/../../obj/local/armeabi/libsdl_main.so@@" | sed "s@$LOCAL_PATH/../../obj/local/armeabi/libapplication.so@@"` \
$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/lib/libc.so \ $NDK/build/platforms/$PLATFORMVER/arch-arm/usr/lib/libc.so \
$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/lib/libstdc++.so \ $NDK/build/platforms/$PLATFORMVER/arch-arm/usr/lib/libstdc++.so \
@@ -48,17 +59,20 @@ $NDK/build/platforms/$PLATFORMVER/arch-arm/usr/lib/libm.so \
-Wl,-rpath-link=$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/lib \ -Wl,-rpath-link=$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/lib \
-L$LOCAL_PATH/../../obj/local/armeabi" -L$LOCAL_PATH/../../obj/local/armeabi"
env PATH=$NDK/build/prebuilt/linux-x86/arm-eabi-$GCCVER/bin:$LOCAL_PATH:$PATH \ # Comment out if you're using CrystaX toolchain
LDFLAGS="$LDFLAGS $LOCAL_PATH/../../obj/local/armeabi/libstlport.a"
env PATH=$NDK/build/prebuilt/$MYARCH/arm-eabi-$GCCVER/bin:$LOCAL_PATH:$PATH \
CFLAGS="$CFLAGS" \ CFLAGS="$CFLAGS" \
CXXFLAGS="$CFLAGS" \ CXXFLAGS="$CFLAGS" \
LDFLAGS="$LDFLAGS" \ LDFLAGS="$LDFLAGS" \
CC="$NDK/build/prebuilt/linux-x86/arm-eabi-$GCCVER/bin/arm-eabi-gcc" \ CC="$NDK/build/prebuilt/$MYARCH/arm-eabi-$GCCVER/bin/arm-eabi-gcc" \
CXX="$NDK/build/prebuilt/linux-x86/arm-eabi-$GCCVER/bin/arm-eabi-g++" \ CXX="$NDK/build/prebuilt/$MYARCH/arm-eabi-$GCCVER/bin/arm-eabi-g++" \
RANLIB="$NDK/build/prebuilt/linux-x86/arm-eabi-$GCCVER/bin/arm-eabi-ranlib" \ RANLIB="$NDK/build/prebuilt/$MYARCH/arm-eabi-$GCCVER/bin/arm-eabi-ranlib" \
LD="$NDK/build/prebuilt/linux-x86/arm-eabi-$GCCVER/bin/arm-eabi-gcc" \ LD="$NDK/build/prebuilt/$MYARCH/arm-eabi-$GCCVER/bin/arm-eabi-gcc" \
AR="$NDK/build/prebuilt/linux-x86/arm-eabi-$GCCVER/bin/arm-eabi-ar" \ AR="$NDK/build/prebuilt/$MYARCH/arm-eabi-$GCCVER/bin/arm-eabi-ar" \
CPP="$NDK/build/prebuilt/linux-x86/arm-eabi-$GCCVER/bin/arm-eabi-cpp $CFLAGS" \ CPP="$NDK/build/prebuilt/$MYARCH/arm-eabi-$GCCVER/bin/arm-eabi-cpp $CFLAGS" \
NM="$NDK/build/prebuilt/linux-x86/arm-eabi-$GCCVER/bin/arm-eabi-nm" \ NM="$NDK/build/prebuilt/$MYARCH/arm-eabi-$GCCVER/bin/arm-eabi-nm" \
AS="$NDK/build/prebuilt/linux-x86/arm-eabi-$GCCVER/bin/arm-eabi-as" \ AS="$NDK/build/prebuilt/$MYARCH/arm-eabi-$GCCVER/bin/arm-eabi-as" \
STRIP="$NDK/build/prebuilt/linux-x86/arm-eabi-$GCCVER/bin/arm-eabi-strip" \ STRIP="$NDK/build/prebuilt/$MYARCH/arm-eabi-$GCCVER/bin/arm-eabi-strip" \
./configure --host=arm-eabi "$@" ./configure --host=arm-eabi "$@"

View File

@@ -1 +1 @@
alienblaster enigma

View File

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

View File

@@ -376,11 +376,11 @@ void updateOrientation ( float accX, float accY, float accZ )
if( isJoystickUsed && CurrentJoysticks[0] ) // TODO: mutex for that stuff? if( isJoystickUsed && CurrentJoysticks[0] ) // TODO: mutex for that stuff?
{ {
// TODO: fix coefficients SDL_PrivateJoystickAxis(CurrentJoysticks[0], 0, (Sint16)(fmin(32767, fmax(-32768, (accX - midX) * 400.0))));
SDL_PrivateJoystickAxis(CurrentJoysticks[0], 0, (accX - midX) * 1000); SDL_PrivateJoystickAxis(CurrentJoysticks[0], 1, (Sint16)(fmin(32767, fmax(-32768, (accY - midY) * 400.0))));
SDL_PrivateJoystickAxis(CurrentJoysticks[0], 1, (accY - midY) * 1000); SDL_PrivateJoystickAxis(CurrentJoysticks[0], 2, (Sint16)(fmin(32767, fmax(-32768, (accZ - midZ) * 400.0))));
SDL_PrivateJoystickAxis(CurrentJoysticks[0], 2, (accZ - midZ) * 1000);
// TODO: option for fixed/floating center pos
if( accY < midY - dy*2 ) if( accY < midY - dy*2 )
midY = accY + dy*2; midY = accY + dy*2;
if( accY > midY + dy*2 ) if( accY > midY + dy*2 )
@@ -389,9 +389,12 @@ void updateOrientation ( float accX, float accY, float accZ )
midZ = accZ + dz*2; midZ = accZ + dz*2;
if( accZ > midZ + dz*2 ) if( accZ > midZ + dz*2 )
midZ = accZ - dz*2; midZ = accZ - dz*2;
return;
} }
if(isJoystickUsed)
return;
if( accX < midX - dx ) if( accX < midX - dx )
{ {
@@ -643,7 +646,7 @@ void SDL_ANDROID_processAndroidTrackballDampening()
int SDL_SYS_JoystickInit(void) int SDL_SYS_JoystickInit(void)
{ {
SDL_numjoysticks = MAX_MULTITOUCH_POINTERS+1; SDL_numjoysticks = MAX_MULTITOUCH_POINTERS+1;
return(0); return(SDL_numjoysticks);
} }
/* Function to get the device-dependent name of a joystick */ /* Function to get the device-dependent name of a joystick */

View File

@@ -94,8 +94,19 @@ JAVA_EXPORT_NAME(DemoRenderer_nativeResize) ( JNIEnv* env, jobject thiz, jint
{ {
if( SDL_ANDROID_sWindowWidth == 0 ) if( SDL_ANDROID_sWindowWidth == 0 )
{ {
#if SDL_VIDEO_RENDER_RESIZE_KEEP_ASPECT
// TODO: tweak that parameters when app calls SetVideoMode(), not here - app may request something else than 640x480, it's okay for most apps though
// Also this should be user-configurable setting, not compiler option
SDL_ANDROID_sWindowWidth = (SDL_ANDROID_sFakeWindowWidth*h)/SDL_ANDROID_sFakeWindowHeight;
SDL_ANDROID_sWindowHeight = h;
if(SDL_ANDROID_sWindowWidth > w) {
SDL_ANDROID_sWindowWidth = w;
SDL_ANDROID_sWindowHeight = (SDL_ANDROID_sFakeWindowHeight*w)/SDL_ANDROID_sFakeWindowWidth;
}
#else
SDL_ANDROID_sWindowWidth = w; SDL_ANDROID_sWindowWidth = w;
SDL_ANDROID_sWindowHeight = h; SDL_ANDROID_sWindowHeight = h;
#endif
__android_log_print(ANDROID_LOG_INFO, "libSDL", "Physical screen resolution is %dx%d", w, h); __android_log_print(ANDROID_LOG_INFO, "libSDL", "Physical screen resolution is %dx%d", w, h);
} }
} }

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="app_name">Alien Blaster</string> <string name="app_name">enigma</string>
<string name="init">Initializing</string> <string name="init">Initializing</string>
@@ -54,9 +54,10 @@
<string name="accel_slow">Slow</string> <string name="accel_slow">Slow</string>
<string name="accel_question">Accelerometer sensitivity</string> <string name="accel_question">Accelerometer sensitivity</string>
<string name="audiobuf_small">Small (fast devices, less lag)</string> <string name="audiobuf_verysmall">Very small (fast devices, less lag)</string>
<string name="audiobuf_small">Small</string>
<string name="audiobuf_medium">Medium</string> <string name="audiobuf_medium">Medium</string>
<string name="audiobuf_large">Large (if sound is choppy)</string> <string name="audiobuf_large">Large (older devices, if sound is choppy)</string>
<string name="audiobuf_question">Size of audio buffer</string> <string name="audiobuf_question">Size of audio buffer</string>
</resources> </resources>

View File

@@ -1,5 +1,5 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount // This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package de.schwardtnet.alienblaster; package org.enigmagame.enigma;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
@@ -52,16 +52,19 @@ class AccelerometerReader implements SensorEventListener {
if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER)
{ {
if( Globals.HorizontalOrientation ) if( Globals.HorizontalOrientation )
nativeAccelerometer(event.values[1], -event.values[0], event.values[2]); // TODO: it feels better for me to use tilt as X value instead of intuitive horizontal phone orientation
// because then I can hold device comfortably, we need another user-configurable option for that
// nativeOrientation(event.values[1], -event.values[2], event.values[0]); // Comfortable setting
nativeAccelerometer(event.values[1], -event.values[0], event.values[2]); // Intuitive setting
else else
nativeAccelerometer(event.values[0], event.values[1], event.values[2]); nativeAccelerometer(event.values[0], event.values[1], event.values[2]);
} }
else else
{ {
if( Globals.HorizontalOrientation ) if( Globals.HorizontalOrientation )
nativeOrientation(event.values[1], -event.values[0], event.values[2]); nativeOrientation(event.values[1], -event.values[2], event.values[0]);
else else
nativeOrientation(event.values[0], event.values[1], event.values[2]); nativeOrientation(event.values[2], event.values[1], event.values[0]);
} }
} }

View File

@@ -1,6 +1,6 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change // This string is autogenerated by ChangeAppSettings.sh, do not change
// spaces amount // spaces amount
package de.schwardtnet.alienblaster; package org.enigmagame.enigma;
import java.util.zip.*; import java.util.zip.*;
import java.io.*; import java.io.*;

View File

@@ -1,5 +1,5 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount // This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package de.schwardtnet.alienblaster; package org.enigmagame.enigma;
import android.app.Activity; import android.app.Activity;
@@ -23,6 +23,7 @@ class AudioThread {
private Activity mParent; private Activity mParent;
private AudioTrack mAudio; private AudioTrack mAudio;
private byte[] mAudioBuffer; private byte[] mAudioBuffer;
private int mVirtualBufSize;
public AudioThread(Activity parent) public AudioThread(Activity parent)
{ {
@@ -34,7 +35,7 @@ class AudioThread {
public int fillBuffer() public int fillBuffer()
{ {
mAudio.write( mAudioBuffer, 0, mAudioBuffer.length ); mAudio.write( mAudioBuffer, 0, mVirtualBufSize );
return 1; return 1;
} }
@@ -47,11 +48,15 @@ class AudioThread {
encoding = ( encoding == 1 ) ? AudioFormat.ENCODING_PCM_16BIT : encoding = ( encoding == 1 ) ? AudioFormat.ENCODING_PCM_16BIT :
AudioFormat.ENCODING_PCM_8BIT; AudioFormat.ENCODING_PCM_8BIT;
mVirtualBufSize = bufSize;
if( AudioTrack.getMinBufferSize( rate, channels, encoding ) > bufSize ) if( AudioTrack.getMinBufferSize( rate, channels, encoding ) > bufSize )
bufSize = AudioTrack.getMinBufferSize( rate, channels, encoding ); bufSize = AudioTrack.getMinBufferSize( rate, channels, encoding );
bufSize = (int)((float)bufSize * (((float)Globals.AudioBufferConfig * 2.5f) + 1.0f)); if(Globals.AudioBufferConfig != 0) { // application's choice - use minimal buffer
bufSize = (int)((float)bufSize * (((float)(Globals.AudioBufferConfig - 1) * 2.5f) + 1.0f));
mVirtualBufSize = bufSize;
}
mAudioBuffer = new byte[bufSize]; mAudioBuffer = new byte[bufSize];
mAudio = new AudioTrack(AudioManager.STREAM_MUSIC, mAudio = new AudioTrack(AudioManager.STREAM_MUSIC,
@@ -62,7 +67,7 @@ class AudioThread {
AudioTrack.MODE_STREAM ); AudioTrack.MODE_STREAM );
mAudio.play(); mAudio.play();
} }
return mAudioBuffer.length; return mVirtualBufSize;
} }
public byte[] getBuffer() public byte[] getBuffer()

View File

@@ -1,5 +1,5 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount // This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package de.schwardtnet.alienblaster; package org.enigmagame.enigma;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;

View File

@@ -18,7 +18,7 @@
fixed with a hammer and rasp to work with libSDL port */ fixed with a hammer and rasp to work with libSDL port */
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount // This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package de.schwardtnet.alienblaster; package org.enigmagame.enigma;
import java.io.Writer; import java.io.Writer;
import java.util.ArrayList; import java.util.ArrayList;

View File

@@ -1,37 +1,40 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount anywhere // This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount anywhere
package de.schwardtnet.alienblaster; package org.enigmagame.enigma;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
class Globals { class Globals {
public static String ApplicationName = "AlienBlaster"; public static String ApplicationName = "enigma";
// Should be zip file // Should be zip file
public static String DataDownloadUrl = "Data size is 2 Mb|alienblaster110_data.zip|http://sites.google.com/site/xpelyax/Home/alienblaster110_data.zip?attredirects=0%26d=1|http://sitesproxy.goapk.com/site/xpelyax/Home/alienblaster110_data.zip"; public static String DataDownloadUrl = "Enigma Game Data (6.5 MiB)|http://sites.google.com/site/droidsdl/data/enigma-data32.zip?attredirects=0%26d=1";
// Set this value to true if you're planning to render 3D using OpenGL - it eats some GFX resources, so disabled for 2D // 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; public static boolean NeedDepthBuffer = false;
// Set this value to true if you're planning to render 3D using OpenGL - it eats some GFX resources, so disabled for 2D // 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 HorizontalOrientation = true; public static boolean HorizontalOrientation = true;
// prevent device from going to suspend mode
public static boolean InhibitSuspend = true;
// Readme text to be shown on download page // Readme text to be shown on download page
public static String ReadmeText = "^You can press \"Home\" now - the data will be downloaded in background^In game press \"Menu\" for secondary fire, \"Volume Up/Down\" to cycle weapons".replace("^","\n"); public static String ReadmeText = "^You can press \"Home\" now - the data will be downloaded in background^Have fun playing enigma!^".replace("^","\n");
public static boolean AppUsesMouse = false; public static boolean AppUsesMouse = true;
public static boolean AppNeedsArrowKeys = true; public static boolean AppNeedsArrowKeys = false;
public static boolean AppUsesJoystick = false; public static boolean AppUsesJoystick = true;
public static boolean AppUsesMultitouch = false; public static boolean AppUsesMultitouch = false;
public static boolean NonBlockingSwapBuffers = false; public static boolean NonBlockingSwapBuffers = false;
public static int AppTouchscreenKeyboardKeysAmount = 4; public static int AppTouchscreenKeyboardKeysAmount = 0;
public static int AppTouchscreenKeyboardKeysAmountAutoFire = 1; public static int AppTouchscreenKeyboardKeysAmountAutoFire = 0;
// Phone-specific config // Phone-specific config
// It will download app data to /sdcard/alienblaster if set to true, // It will download app data to /sdcard/alienblaster if set to true,
@@ -50,5 +53,5 @@ class Globals {
} }
class LoadLibrary { class LoadLibrary {
public LoadLibrary() { System.loadLibrary("sdl-1.3"); System.loadLibrary("sdl_mixer"); System.loadLibrary("sdl_image"); }; public LoadLibrary() { System.loadLibrary("sdl-1.2"); System.loadLibrary("sdl_mixer"); System.loadLibrary("sdl_image"); System.loadLibrary("sdl_ttf"); System.loadLibrary("intl"); System.loadLibrary("lua"); };
} }

View File

@@ -1,5 +1,5 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount // This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package de.schwardtnet.alienblaster; package org.enigmagame.enigma;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
@@ -21,6 +21,11 @@ public class MainActivity extends Activity {
requestWindowFeature(Window.FEATURE_NO_TITLE); requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN); WindowManager.LayoutParams.FLAG_FULLSCREEN);
if(Globals.InhibitSuspend)
getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
_tv = new TextView(this); _tv = new TextView(this);
_tv.setText(R.string.init); _tv.setText(R.string.init);

View File

@@ -1,5 +1,5 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount // This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package de.schwardtnet.alienblaster; package org.enigmagame.enigma;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
@@ -433,7 +433,8 @@ class Settings
static void showAudioConfig(final MainActivity p) static void showAudioConfig(final MainActivity p)
{ {
final CharSequence[] items = { p.getResources().getString(R.string.audiobuf_small), final CharSequence[] items = { p.getResources().getString(R.string.audiobuf_verysmall),
p.getResources().getString(R.string.audiobuf_small),
p.getResources().getString(R.string.audiobuf_medium), p.getResources().getString(R.string.audiobuf_medium),
p.getResources().getString(R.string.audiobuf_large) }; p.getResources().getString(R.string.audiobuf_large) };

View File

@@ -1,5 +1,5 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount // This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package de.schwardtnet.alienblaster; package org.enigmagame.enigma;
import javax.microedition.khronos.opengles.GL10; import javax.microedition.khronos.opengles.GL10;