Made screen orientation, BPP, immersive mode and sub-frame touch events a user configurable options
This commit is contained in:
@@ -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"
|
||||
>
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -112,6 +112,7 @@
|
||||
<string name="mouse_gyroscope_mouse">Control mouse with gyroscope</string>
|
||||
<string name="mouse_gyroscope_mouse_sensitivity">Gyroscope sensitivity</string>
|
||||
<string name="mouse_finger_hover">Finger hover</string>
|
||||
<string name="mouse_subframe_touch_events">Multiple touch events per video frame</string>
|
||||
|
||||
<string name="none">None</string>
|
||||
|
||||
@@ -151,7 +152,10 @@
|
||||
|
||||
<string name="video">Video settings</string>
|
||||
<string name="video_smooth">Linear video filtering</string>
|
||||
<string name="video_separatethread">Separate thread for video, will increase FPS on some devices</string>
|
||||
<string name="video_separatethread">Separate thread for video, it can increase FPS, it also can crash the app</string>
|
||||
<string name="video_orientation_vertical">Portrait/vertical screen orientation</string>
|
||||
<string name="video_bpp_24">24 bpp screen color depth</string>
|
||||
<string name="video_immersive">Hide system navigation buttons / immersive mode</string>
|
||||
|
||||
<string name="text_edit_click_here">Tap to start typing, press Back when done</string>
|
||||
|
||||
|
||||
11
todo.txt
11
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.
|
||||
|
||||
Reference in New Issue
Block a user