SDL: option to disable TV borders
This commit is contained in:
@@ -119,6 +119,7 @@ class Globals
|
||||
public static boolean HoverJitterFilter = true;
|
||||
public static boolean GenerateSubframeTouchEvents = false;
|
||||
public static boolean KeepAspectRatio = KeepAspectRatioDefaultSetting;
|
||||
public static boolean TvBorders = true;
|
||||
public static int RemapHwKeycode[] = new int[SDL_Keys.JAVA_KEYCODE_LAST];
|
||||
public static int RemapScreenKbKeycode[] = new int[6];
|
||||
public static int ScreenKbControlsLayout[][] = AppUsesThirdJoystick ? // Values for 800x480 resolution
|
||||
|
||||
@@ -352,10 +352,11 @@ public class MainActivity extends Activity
|
||||
SetLayerType.get().setLayerType(mGLView);
|
||||
FrameLayout.LayoutParams margin = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
|
||||
// Add TV screen borders, if needed
|
||||
margin.setMargins( getResources().getDimensionPixelOffset(R.dimen.screen_border_horizontal),
|
||||
getResources().getDimensionPixelOffset(R.dimen.screen_border_vertical),
|
||||
getResources().getDimensionPixelOffset(R.dimen.screen_border_horizontal),
|
||||
getResources().getDimensionPixelOffset(R.dimen.screen_border_vertical));
|
||||
if( Globals.TvBorders )
|
||||
margin.setMargins( getResources().getDimensionPixelOffset(R.dimen.screen_border_horizontal),
|
||||
getResources().getDimensionPixelOffset(R.dimen.screen_border_vertical),
|
||||
getResources().getDimensionPixelOffset(R.dimen.screen_border_horizontal),
|
||||
getResources().getDimensionPixelOffset(R.dimen.screen_border_vertical));
|
||||
_videoLayout.addView(mGLView, margin);
|
||||
mGLView.setFocusableInTouchMode(true);
|
||||
mGLView.setFocusable(true);
|
||||
@@ -779,7 +780,7 @@ public class MainActivity extends Activity
|
||||
screenKeyboard.setOnKeyListener(new simpleKeyListener(this));
|
||||
screenKeyboard.setBackgroundColor(Color.BLACK); // Full opaque - do not show semi-transparent edit box, it's confusing
|
||||
screenKeyboard.setTextColor(Color.WHITE); // Just to be sure about gamma
|
||||
if( isRunningOnOUYA() )
|
||||
if( isRunningOnOUYA() && Globals.TvBorders )
|
||||
screenKeyboard.setPadding(100, 100, 100, 100); // Bad bad HDMI TVs all have cropped borders
|
||||
_screenKeyboard = screenKeyboard;
|
||||
_videoLayout.addView(_screenKeyboard);
|
||||
|
||||
@@ -185,6 +185,7 @@ class Settings
|
||||
out.writeBoolean(Globals.HorizontalOrientation);
|
||||
out.writeBoolean(Globals.ImmersiveMode);
|
||||
out.writeBoolean(Globals.AutoDetectOrientation);
|
||||
out.writeBoolean(Globals.TvBorders);
|
||||
|
||||
out.close();
|
||||
settingsLoaded = true;
|
||||
@@ -377,6 +378,7 @@ class Settings
|
||||
Globals.HorizontalOrientation = settingsFile.readBoolean();
|
||||
Globals.ImmersiveMode = settingsFile.readBoolean();
|
||||
Globals.AutoDetectOrientation = settingsFile.readBoolean();
|
||||
Globals.TvBorders = settingsFile.readBoolean();
|
||||
|
||||
settingsLoaded = true;
|
||||
|
||||
|
||||
@@ -357,6 +357,7 @@ class SettingsMenuMisc extends SettingsMenu
|
||||
p.getResources().getString(R.string.video_orientation_autodetect),
|
||||
p.getResources().getString(R.string.video_orientation_vertical),
|
||||
p.getResources().getString(R.string.video_bpp_24),
|
||||
p.getResources().getString(R.string.tv_borders),
|
||||
};
|
||||
boolean defaults[] = {
|
||||
Globals.KeepAspectRatio,
|
||||
@@ -365,6 +366,7 @@ class SettingsMenuMisc extends SettingsMenu
|
||||
Globals.AutoDetectOrientation,
|
||||
!Globals.HorizontalOrientation,
|
||||
Globals.VideoDepthBpp == 24,
|
||||
Globals.TvBorders,
|
||||
};
|
||||
|
||||
if(Globals.SwVideoMode && !Globals.CompatibilityHacksVideo)
|
||||
@@ -376,6 +378,7 @@ class SettingsMenuMisc extends SettingsMenu
|
||||
p.getResources().getString(R.string.video_orientation_autodetect),
|
||||
p.getResources().getString(R.string.video_orientation_vertical),
|
||||
p.getResources().getString(R.string.video_bpp_24),
|
||||
p.getResources().getString(R.string.tv_borders),
|
||||
p.getResources().getString(R.string.video_separatethread),
|
||||
};
|
||||
boolean defaults2[] = {
|
||||
@@ -385,6 +388,7 @@ class SettingsMenuMisc extends SettingsMenu
|
||||
Globals.AutoDetectOrientation,
|
||||
!Globals.HorizontalOrientation,
|
||||
Globals.VideoDepthBpp == 24,
|
||||
Globals.TvBorders,
|
||||
Globals.MultiThreadedVideo,
|
||||
};
|
||||
items = items2;
|
||||
@@ -422,52 +426,12 @@ class SettingsMenuMisc extends SettingsMenu
|
||||
if( item == 5 )
|
||||
Globals.VideoDepthBpp = (isChecked ? 24 : 16);
|
||||
if( item == 6 )
|
||||
Globals.TvBorders = isChecked;
|
||||
if( item == 7 )
|
||||
Globals.MultiThreadedVideo = isChecked;
|
||||
}
|
||||
});
|
||||
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
|
||||
{
|
||||
public void onClick(DialogInterface dialog, int item)
|
||||
{
|
||||
dialog.dismiss();
|
||||
if( debugMenuShowCount > 5 || Globals.OuyaEmulation )
|
||||
showDebugMenu(p);
|
||||
else
|
||||
goBack(p);
|
||||
}
|
||||
});
|
||||
builder.setOnCancelListener(new DialogInterface.OnCancelListener()
|
||||
{
|
||||
public void onCancel(DialogInterface dialog)
|
||||
{
|
||||
goBack(p);
|
||||
}
|
||||
});
|
||||
AlertDialog alert = builder.create();
|
||||
alert.setOwnerActivity(p);
|
||||
alert.show();
|
||||
}
|
||||
|
||||
void showDebugMenu (final MainActivity p)
|
||||
{
|
||||
CharSequence[] items = {
|
||||
"OUYA emulation"
|
||||
};
|
||||
boolean defaults[] = {
|
||||
Globals.OuyaEmulation,
|
||||
};
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(p);
|
||||
builder.setTitle("Debug settings");
|
||||
builder.setMultiChoiceItems(items, defaults, new DialogInterface.OnMultiChoiceClickListener()
|
||||
{
|
||||
public void onClick(DialogInterface dialog, int item, boolean isChecked)
|
||||
{
|
||||
if( item == 0 )
|
||||
Globals.OuyaEmulation = isChecked;
|
||||
}
|
||||
});
|
||||
builder.setPositiveButton(p.getResources().getString(R.string.ok), new DialogInterface.OnClickListener()
|
||||
{
|
||||
public void onClick(DialogInterface dialog, int item)
|
||||
{
|
||||
|
||||
@@ -157,6 +157,7 @@
|
||||
<string name="video_orientation_autodetect">Auto-detect 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="tv_borders">TV borders</string>
|
||||
|
||||
<string name="text_edit_click_here">Tap to start typing, press Back when done</string>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user