diff --git a/project/AndroidManifestTemplate.xml b/project/AndroidManifestTemplate.xml
index dca5f9fcb..e51d030ef 100644
--- a/project/AndroidManifestTemplate.xml
+++ b/project/AndroidManifestTemplate.xml
@@ -13,7 +13,6 @@
android:label="@string/app_name"
android:alwaysRetainTaskState="true"
android:launchMode="singleTask"
- android:screenOrientation="sensorLandscape"
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|fontScale|uiMode|screenSize|smallestScreenSize"
android:windowSoftInputMode="stateUnspecified|adjustPan"
>
diff --git a/project/java/Globals.java b/project/java/Globals.java
index b1f589f71..13e4e420b 100644
--- a/project/java/Globals.java
+++ b/project/java/Globals.java
@@ -35,7 +35,6 @@ class Globals
public static final boolean Using_SDL_1_3 = false;
public static final boolean Using_SDL_2_0 = false;
public static String[] DataDownloadUrl = { "Data files are 2 Mb|https://sourceforge.net/projects/libsdl-android/files/CommanderGenius/commandergenius-data.zip/download", "High-quality GFX and music - 40 Mb|https://sourceforge.net/projects/libsdl-android/files/CommanderGenius/commandergenius-hqp.zip/download" };
- public static int VideoDepthBpp = 16;
public static boolean SwVideoMode = false;
public static boolean NeedDepthBuffer = false;
public static boolean NeedStencilBuffer = false;
@@ -44,7 +43,6 @@ class Globals
public static boolean CompatibilityHacksForceScreenUpdateMouseClick = true;
public static boolean CompatibilityHacksStaticInit = false;
public static boolean CompatibilityHacksTextInputEmulatesHwKeyboard = false;
- public static boolean HorizontalOrientation = true;
public static boolean KeepAspectRatioDefaultSetting = false;
public static boolean InhibitSuspend = false;
public static boolean CreateService = false;
@@ -55,7 +53,6 @@ class Globals
public static boolean RightMouseButtonLongPress = true;
public static boolean ForceRelativeMouseMode = false; // If both on-screen keyboard and mouse are needed, this will only set the default setting, user may override it later
public static boolean ShowMouseCursor = false;
- public static boolean GenerateSubframeTouchEvents = false;
public static boolean AppNeedsArrowKeys = true;
public static boolean AppNeedsTextInput = true;
public static boolean AppUsesJoystick = false;
@@ -65,7 +62,6 @@ class Globals
public static boolean AppUsesGyroscope = false;
public static boolean AppUsesMultitouch = false;
public static boolean NonBlockingSwapBuffers = false;
- public static boolean ImmersiveMode = true;
public static boolean ResetSdlConfigForThisVersion = false;
public static String DeleteFilesOnUpgrade = "";
public static int AppTouchscreenKeyboardKeysAmount = 4;
@@ -79,6 +75,9 @@ class Globals
public static String AdmobBannerSize = "";
// Phone-specific config, modified by user in "Change phone config" startup dialog
+ public static int VideoDepthBpp = 16;
+ public static boolean HorizontalOrientation = true;
+ public static boolean ImmersiveMode = true;
public static boolean DownloadToSdcard = true;
public static boolean PhoneHasTrackball = false;
public static boolean PhoneHasArrowKeys = false;
@@ -115,6 +114,7 @@ class Globals
public static int ClickScreenTouchspotSize = 0;
public static boolean FingerHover = true;
public static boolean HoverJitterFilter = true;
+ public static boolean GenerateSubframeTouchEvents = false;
public static boolean KeepAspectRatio = KeepAspectRatioDefaultSetting;
public static int RemapHwKeycode[] = new int[SDL_Keys.JAVA_KEYCODE_LAST];
public static int RemapScreenKbKeycode[] = new int[6];
diff --git a/project/java/MainActivity.java b/project/java/MainActivity.java
index e00431fd5..c43df63c1 100644
--- a/project/java/MainActivity.java
+++ b/project/java/MainActivity.java
@@ -87,12 +87,7 @@ public class MainActivity extends Activity
{
super.onCreate(savedInstanceState);
- //if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR2 )
- // setRequestedOrientation(Globals.HorizontalOrientation ? ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT);
- if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD )
- setRequestedOrientation(Globals.HorizontalOrientation ? ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
- else
- setRequestedOrientation(Globals.HorizontalOrientation ? ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
+ setScreenOrientation();
instance = this;
// fullscreen mode
@@ -127,6 +122,7 @@ public class MainActivity extends Activity
setUpStatusLabel();
Log.i("SDL", "libSDL: User clicked change phone config button");
loadedLibraries.acquireUninterruptibly();
+ setScreenOrientation();
SettingsMenu.showConfig(p, false);
}
};
@@ -269,6 +265,7 @@ public class MainActivity extends Activity
public void initSDL()
{
+ setScreenOrientation();
(new Thread(new Runnable()
{
public void run()
@@ -312,6 +309,7 @@ public class MainActivity extends Activity
Log.i("SDL", "libSDL: Initializing video and SDL application");
sdlInited = true;
+ DimSystemStatusBar.get().dim(_videoLayout);
_videoLayout.removeView(_layout);
if( _ad.getView() != null )
_videoLayout.removeView(_ad.getView());
@@ -334,7 +332,6 @@ public class MainActivity extends Activity
_videoLayout.addView(_ad.getView());
_ad.getView().setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.TOP | Gravity.RIGHT));
}
- // Receive keyboard events
DimSystemStatusBar.get().dim(_videoLayout);
DimSystemStatusBar.get().dim(mGLView);
}
@@ -1184,6 +1181,14 @@ public class MainActivity extends Activity
return getOrient.getWidth() >= getOrient.getHeight();
}
+ void setScreenOrientation()
+ {
+ if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.GINGERBREAD )
+ setRequestedOrientation(Globals.HorizontalOrientation ? ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
+ else
+ setRequestedOrientation(Globals.HorizontalOrientation ? ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE : ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
+ }
+
public FrameLayout getVideoLayout() { return _videoLayout; }
static int NOTIFY_ID = 12367098; // Random ID
diff --git a/project/java/Settings.java b/project/java/Settings.java
index 4086fb5e2..fa3a34e1e 100644
--- a/project/java/Settings.java
+++ b/project/java/Settings.java
@@ -178,6 +178,10 @@ class Settings
out.writeInt(Globals.MoveMouseWithGyroscopeSpeed);
out.writeBoolean(Globals.FingerHover);
out.writeBoolean(Globals.FloatingScreenJoystick);
+ out.writeBoolean(Globals.GenerateSubframeTouchEvents);
+ out.writeInt(Globals.VideoDepthBpp);
+ out.writeBoolean(Globals.HorizontalOrientation);
+ out.writeBoolean(Globals.ImmersiveMode);
out.close();
settingsLoaded = true;
@@ -366,6 +370,10 @@ class Settings
Globals.MoveMouseWithGyroscopeSpeed = settingsFile.readInt();
Globals.FingerHover = settingsFile.readBoolean();
Globals.FloatingScreenJoystick = settingsFile.readBoolean();
+ Globals.GenerateSubframeTouchEvents = settingsFile.readBoolean();
+ Globals.VideoDepthBpp = settingsFile.readInt();
+ Globals.HorizontalOrientation = settingsFile.readBoolean();
+ Globals.ImmersiveMode = settingsFile.readBoolean();
settingsLoaded = true;
diff --git a/project/java/SettingsMenuMisc.java b/project/java/SettingsMenuMisc.java
index 0a3a223ba..6425c0006 100644
--- a/project/java/SettingsMenuMisc.java
+++ b/project/java/SettingsMenuMisc.java
@@ -345,11 +345,17 @@ class SettingsMenuMisc extends SettingsMenu
debugMenuShowCount++;
CharSequence[] items = {
p.getResources().getString(R.string.mouse_keepaspectratio),
- p.getResources().getString(R.string.video_smooth)
+ p.getResources().getString(R.string.video_smooth),
+ p.getResources().getString(R.string.video_immersive),
+ p.getResources().getString(R.string.video_orientation_vertical),
+ p.getResources().getString(R.string.video_bpp_24),
};
- boolean defaults[] = {
+ boolean defaults[] = {
Globals.KeepAspectRatio,
- Globals.VideoLinearFilter
+ Globals.VideoLinearFilter,
+ Globals.ImmersiveMode,
+ !Globals.HorizontalOrientation,
+ Globals.VideoDepthBpp == 24,
};
if(Globals.SwVideoMode && !Globals.CompatibilityHacksVideo)
@@ -357,12 +363,18 @@ class SettingsMenuMisc extends SettingsMenu
CharSequence[] items2 = {
p.getResources().getString(R.string.mouse_keepaspectratio),
p.getResources().getString(R.string.video_smooth),
+ p.getResources().getString(R.string.video_immersive),
+ p.getResources().getString(R.string.video_orientation_vertical),
+ p.getResources().getString(R.string.video_bpp_24),
p.getResources().getString(R.string.video_separatethread),
};
boolean defaults2[] = {
Globals.KeepAspectRatio,
Globals.VideoLinearFilter,
- Globals.MultiThreadedVideo
+ Globals.ImmersiveMode,
+ !Globals.HorizontalOrientation,
+ Globals.VideoDepthBpp == 24,
+ Globals.MultiThreadedVideo,
};
items = items2;
defaults = defaults2;
@@ -391,6 +403,12 @@ class SettingsMenuMisc extends SettingsMenu
if( item == 1 )
Globals.VideoLinearFilter = isChecked;
if( item == 2 )
+ Globals.ImmersiveMode = isChecked;
+ if( item == 3 )
+ Globals.HorizontalOrientation = !isChecked;
+ if( item == 4 )
+ Globals.VideoDepthBpp = (isChecked ? 24 : 16);
+ if( item == 5 )
Globals.MultiThreadedVideo = isChecked;
}
});
diff --git a/project/java/SettingsMenuMouse.java b/project/java/SettingsMenuMouse.java
index f0f20ef1a..e1f5feeb1 100644
--- a/project/java/SettingsMenuMouse.java
+++ b/project/java/SettingsMenuMouse.java
@@ -420,6 +420,7 @@ class SettingsMenuMouse extends SettingsMenu
p.getResources().getString(R.string.mouse_relative),
p.getResources().getString(R.string.mouse_gyroscope_mouse),
p.getResources().getString(R.string.mouse_finger_hover),
+ p.getResources().getString(R.string.mouse_subframe_touch_events),
};
boolean defaults[] = {
@@ -429,9 +430,9 @@ class SettingsMenuMouse extends SettingsMenu
Globals.RelativeMouseMovement,
Globals.MoveMouseWithGyroscope,
Globals.FingerHover,
+ Globals.GenerateSubframeTouchEvents,
};
-
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(p.getResources().getString(R.string.advanced));
builder.setMultiChoiceItems(items, defaults, new DialogInterface.OnMultiChoiceClickListener()
@@ -450,6 +451,8 @@ class SettingsMenuMouse extends SettingsMenu
Globals.MoveMouseWithGyroscope = isChecked;
if( item == 5 )
Globals.FingerHover = isChecked;
+ if( item == 6 )
+ Globals.GenerateSubframeTouchEvents = isChecked;
}
});
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
diff --git a/project/java/translations/values/strings.xml b/project/java/translations/values/strings.xml
index 9f569a1cc..cccde4f67 100644
--- a/project/java/translations/values/strings.xml
+++ b/project/java/translations/values/strings.xml
@@ -112,6 +112,7 @@
Control mouse with gyroscope
Gyroscope sensitivity
Finger hover
+ Multiple touch events per video frame
None
@@ -151,7 +152,10 @@
Video settings
Linear video filtering
- Separate thread for video, will increase FPS on some devices
+ Separate thread for video, it can increase FPS, it also can crash the app
+ Portrait/vertical screen orientation
+ 24 bpp screen color depth
+ Hide system navigation buttons / immersive mode
Tap to start typing, press Back when done
diff --git a/todo.txt b/todo.txt
index dfaabcf78..e94d90b26 100644
--- a/todo.txt
+++ b/todo.txt
@@ -15,17 +15,8 @@ TODO, which will get actually done
- SuperTux: Update, enable OpenGL renderer, add touchscreen jump helper, add gamepad support, fix zoom in settings.
-- SDL: make sub-frame touch events as an user-configurable option.
-
- SDL: control mouse with right analog gamepad stick.
-- SDL: user-configurable option to set screen orientation and BPP.
-
-- SDL: floating on-screen joystick - initially invisible, it appears when you touch the screen,
- centered on your finger, then it slides with your finger if you bump the joystick edge.
-
-- SDL: option to disable immersive mode.
-
- OpenTTD: All menus in the scenario editor are out of the screen.
- OpenTTD: 16bpp blitter with palette animation support.
@@ -54,6 +45,4 @@ TODO, which will get actually done
- Debian noroot: add paths to external SD cards to the proot.
-- XSDL: add downloadable raster fonts, add path to fonts to Debian/Gimp.
-
- Gimp: update - add Java dirs to PATH and use new mouse name in Gimp config.