v0.9.4: Restructured the options menu slightly:

- fullscreen moved to display settings
- orientation toggle removed, game now uses system orientation
This commit is contained in:
Evan Debenham
2021-06-25 17:30:11 -04:00
parent 5f1f3be474
commit 110a8017f7
5 changed files with 35 additions and 71 deletions

View File

@@ -39,7 +39,7 @@
<activity <activity
android:label="${appName}" android:label="${appName}"
android:name=".AndroidGame" android:name=".AndroidGame"
android:screenOrientation="nosensor" android:screenOrientation="user"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"> android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize">
</activity> </activity>

View File

@@ -88,13 +88,6 @@ public class AndroidGame extends AndroidApplication {
instance = this; instance = this;
} }
//set desired orientation (if it exists) before initializing the app.
if (SPDSettings.landscape() != null) {
instance.setRequestedOrientation( SPDSettings.landscape() ?
ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE :
ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT );
}
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
config.depth = 0; config.depth = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {

View File

@@ -55,12 +55,6 @@ import java.util.regex.Pattern;
public class AndroidPlatformSupport extends PlatformSupport { public class AndroidPlatformSupport extends PlatformSupport {
public void updateDisplaySize(){ public void updateDisplaySize(){
if (SPDSettings.landscape() != null) {
AndroidGame.instance.setRequestedOrientation( SPDSettings.landscape() ?
ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE :
ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT );
}
GLSurfaceView view = (GLSurfaceView) ((AndroidGraphics)Gdx.graphics).getView(); GLSurfaceView view = (GLSurfaceView) ((AndroidGraphics)Gdx.graphics).getView();
if (view.getMeasuredWidth() == 0 || view.getMeasuredHeight() == 0) if (view.getMeasuredWidth() == 0 || view.getMeasuredHeight() == 0)
@@ -72,13 +66,6 @@ public class AndroidPlatformSupport extends PlatformSupport {
boolean fullscreen = Build.VERSION.SDK_INT < Build.VERSION_CODES.N boolean fullscreen = Build.VERSION.SDK_INT < Build.VERSION_CODES.N
|| !AndroidGame.instance.isInMultiWindowMode(); || !AndroidGame.instance.isInMultiWindowMode();
if (fullscreen && SPDSettings.landscape() != null
&& (Game.dispWidth >= Game.dispHeight) != SPDSettings.landscape()){
int tmp = Game.dispWidth;
Game.dispWidth = Game.dispHeight;
Game.dispHeight = tmp;
}
float dispRatio = Game.dispWidth / (float)Game.dispHeight; float dispRatio = Game.dispWidth / (float)Game.dispHeight;
float renderWidth = dispRatio > 1 ? PixelScene.MIN_WIDTH_L : PixelScene.MIN_WIDTH_P; float renderWidth = dispRatio > 1 ? PixelScene.MIN_WIDTH_L : PixelScene.MIN_WIDTH_P;

View File

@@ -159,13 +159,12 @@ windows.wndsadghost.cancel=Cancel
windows.wndsadghost.farewell=Farewell, adventurer! windows.wndsadghost.farewell=Farewell, adventurer!
windows.wndsettings$displaytab.title=Display Settings windows.wndsettings$displaytab.title=Display Settings
windows.wndsettings$displaytab.scale=Display Scale windows.wndsettings$displaytab.fullscreen=Fullscreen
windows.wndsettings$displaytab.saver=Power Saver windows.wndsettings$displaytab.saver=Power Saver
windows.wndsettings$displaytab.saver_desc=Power Saver mode draws the game at a reduced size and scales it up to fit your screen.\n\nThis will make graphics less crisp and enlarge the UI slightly, but will also improve performance and battery life.\n\nYou may need to restart the game for changes to take effect. windows.wndsettings$displaytab.saver_desc=Power Saver mode draws the game at a reduced size and scales it up to fit your screen.\n\nThis will make graphics less crisp and enlarge the UI slightly, but will also improve performance and battery life.\n\nYou may need to restart the game for changes to take effect.
windows.wndsettings$displaytab.okay=Okay windows.wndsettings$displaytab.okay=Okay
windows.wndsettings$displaytab.cancel=Cancel windows.wndsettings$displaytab.cancel=Cancel
windows.wndsettings$displaytab.portrait=Switch to portrait windows.wndsettings$displaytab.scale=Display Scale
windows.wndsettings$displaytab.landscape=Switch to landscape
windows.wndsettings$displaytab.brightness=Brightness windows.wndsettings$displaytab.brightness=Brightness
windows.wndsettings$displaytab.dark=Dark windows.wndsettings$displaytab.dark=Dark
windows.wndsettings$displaytab.bright=Bright windows.wndsettings$displaytab.bright=Bright
@@ -180,7 +179,6 @@ windows.wndsettings$uitab.center=Center
windows.wndsettings$uitab.flip_toolbar=Flip Toolbar windows.wndsettings$uitab.flip_toolbar=Flip Toolbar
windows.wndsettings$uitab.flip_indicators=Flip Indicators windows.wndsettings$uitab.flip_indicators=Flip Indicators
windows.wndsettings$uitab.quickslots=Quickslots windows.wndsettings$uitab.quickslots=Quickslots
windows.wndsettings$uitab.fullscreen=Fullscreen
windows.wndsettings$uitab.system_font=System Font windows.wndsettings$uitab.system_font=System Font
windows.wndsettings$uitab.key_bindings=Key Bindings windows.wndsettings$uitab.key_bindings=Key Bindings
windows.wndsettings$datatab.title=Connectivity Settings windows.wndsettings$datatab.title=Connectivity Settings

View File

@@ -189,9 +189,9 @@ public class WndSettings extends WndTabbed {
RenderedTextBlock title; RenderedTextBlock title;
ColorBlock sep1; ColorBlock sep1;
CheckBox chkFullscreen;
OptionSlider optScale; OptionSlider optScale;
CheckBox chkSaver; CheckBox chkSaver;
RedButton btnOrientation;
ColorBlock sep2; ColorBlock sep2;
OptionSlider optBrightness; OptionSlider optBrightness;
OptionSlider optVisGrid; OptionSlider optVisGrid;
@@ -205,6 +205,21 @@ public class WndSettings extends WndTabbed {
sep1 = new ColorBlock(1, 1, 0xFF000000); sep1 = new ColorBlock(1, 1, 0xFF000000);
add(sep1); add(sep1);
chkFullscreen = new CheckBox( Messages.get(this, "fullscreen") ) {
@Override
protected void onClick() {
super.onClick();
SPDSettings.fullscreen(checked());
}
};
if (DeviceCompat.supportsFullScreen()){
chkFullscreen.checked(SPDSettings.fullscreen());
} else {
chkFullscreen.checked(true);
chkFullscreen.enable(false);
}
add(chkFullscreen);
if ((int)Math.ceil(2* Game.density) < PixelScene.maxDefaultZoom) { if ((int)Math.ceil(2* Game.density) < PixelScene.maxDefaultZoom) {
optScale = new OptionSlider(Messages.get(this, "scale"), optScale = new OptionSlider(Messages.get(this, "scale"),
(int)Math.ceil(2* Game.density)+ "X", (int)Math.ceil(2* Game.density)+ "X",
@@ -252,18 +267,6 @@ public class WndSettings extends WndTabbed {
add( chkSaver ); add( chkSaver );
} }
if (!DeviceCompat.isDesktop()) {
btnOrientation = new RedButton(PixelScene.landscape() ?
Messages.get(this, "portrait")
: Messages.get(this, "landscape")) {
@Override
protected void onClick() {
SPDSettings.landscape(!PixelScene.landscape());
}
};
add(btnOrientation);
}
sep2 = new ColorBlock(1, 1, 0xFF000000); sep2 = new ColorBlock(1, 1, 0xFF000000);
add(sep2); add(sep2);
@@ -300,25 +303,23 @@ public class WndSettings extends WndTabbed {
bottom = sep1.y + 1; bottom = sep1.y + 1;
if (optScale != null){ if (width > 200 && chkSaver != null) {
optScale.setRect(0, bottom + GAP, width, SLIDER_HEIGHT); chkFullscreen.setRect(0, bottom + GAP, width/2-1, BTN_HEIGHT);
bottom = optScale.bottom(); chkSaver.setRect(chkFullscreen.right()+ GAP, bottom + GAP, width/2-1, BTN_HEIGHT);
} bottom = chkFullscreen.bottom();
if (width > 200 && chkSaver != null && btnOrientation != null) {
chkSaver.setRect(0, bottom + GAP, width/2-1, BTN_HEIGHT);
btnOrientation.setRect(chkSaver.right()+ GAP, bottom + GAP, width/2-1, BTN_HEIGHT);
bottom = btnOrientation.bottom();
} else { } else {
chkFullscreen.setRect(0, bottom + GAP, width, BTN_HEIGHT);
bottom = chkFullscreen.bottom();
if (chkSaver != null) { if (chkSaver != null) {
chkSaver.setRect(0, bottom + GAP, width, BTN_HEIGHT); chkSaver.setRect(0, bottom + GAP, width, BTN_HEIGHT);
bottom = chkSaver.bottom(); bottom = chkSaver.bottom();
} }
if (btnOrientation != null) {
btnOrientation.setRect(0, bottom + GAP, width, BTN_HEIGHT);
bottom = btnOrientation.bottom();
} }
if (optScale != null){
optScale.setRect(0, bottom + GAP, width, SLIDER_HEIGHT);
bottom = optScale.bottom();
} }
sep2.size(width, 1); sep2.size(width, 1);
@@ -347,7 +348,6 @@ public class WndSettings extends WndTabbed {
CheckBox chkFlipToolbar; CheckBox chkFlipToolbar;
CheckBox chkFlipTags; CheckBox chkFlipTags;
ColorBlock sep2; ColorBlock sep2;
CheckBox chkFullscreen;
CheckBox chkFont; CheckBox chkFont;
ColorBlock sep3; ColorBlock sep3;
RedButton btnKeyBindings; RedButton btnKeyBindings;
@@ -428,17 +428,6 @@ public class WndSettings extends WndTabbed {
sep2 = new ColorBlock(1, 1, 0xFF000000); sep2 = new ColorBlock(1, 1, 0xFF000000);
add(sep2); add(sep2);
chkFullscreen = new CheckBox( Messages.get(this, "fullscreen") ) {
@Override
protected void onClick() {
super.onClick();
SPDSettings.fullscreen(checked());
}
};
chkFullscreen.checked(SPDSettings.fullscreen());
chkFullscreen.enable(DeviceCompat.supportsFullScreen());
add(chkFullscreen);
chkFont = new CheckBox(Messages.get(this, "system_font")){ chkFont = new CheckBox(Messages.get(this, "system_font")){
@Override @Override
protected void onClick() { protected void onClick() {
@@ -493,18 +482,15 @@ public class WndSettings extends WndTabbed {
if (width > 200) { if (width > 200) {
chkFlipToolbar.setRect(0, btnGrouped.bottom() + GAP, width/2 - 1, BTN_HEIGHT); chkFlipToolbar.setRect(0, btnGrouped.bottom() + GAP, width/2 - 1, BTN_HEIGHT);
chkFlipTags.setRect(chkFlipToolbar.right() + GAP, chkFlipToolbar.top(), width/2 -1, BTN_HEIGHT); chkFlipTags.setRect(chkFlipToolbar.right() + GAP, chkFlipToolbar.top(), width/2 -1, BTN_HEIGHT);
sep2.size(width, 1);
sep2.y = chkFlipTags.bottom() + 2;
chkFullscreen.setRect(0, sep2.y + 1 + GAP, width/2 - 1, BTN_HEIGHT);
chkFont.setRect(chkFullscreen.right() + GAP, chkFullscreen.top(), width/2 - 1, BTN_HEIGHT);
} else { } else {
chkFlipToolbar.setRect(0, btnGrouped.bottom() + GAP, width, BTN_HEIGHT); chkFlipToolbar.setRect(0, btnGrouped.bottom() + GAP, width, BTN_HEIGHT);
chkFlipTags.setRect(0, chkFlipToolbar.bottom() + GAP, width, BTN_HEIGHT); chkFlipTags.setRect(0, chkFlipToolbar.bottom() + GAP, width, BTN_HEIGHT);
}
sep2.size(width, 1); sep2.size(width, 1);
sep2.y = chkFlipTags.bottom() + 2; sep2.y = chkFlipTags.bottom() + 2;
chkFullscreen.setRect(0, sep2.y + 1 + GAP, width, BTN_HEIGHT);
chkFont.setRect(0, chkFullscreen.bottom() + GAP, width, BTN_HEIGHT); chkFont.setRect(0, sep2.y + 1 + GAP, width, BTN_HEIGHT);
}
if (btnKeyBindings != null){ if (btnKeyBindings != null){
sep3.size(width, 1); sep3.size(width, 1);