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

View File

@@ -88,13 +88,6 @@ public class AndroidGame extends AndroidApplication {
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();
config.depth = 0;
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 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();
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
|| !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 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.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_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.cancel=Cancel
windows.wndsettings$displaytab.portrait=Switch to portrait
windows.wndsettings$displaytab.landscape=Switch to landscape
windows.wndsettings$displaytab.scale=Display Scale
windows.wndsettings$displaytab.brightness=Brightness
windows.wndsettings$displaytab.dark=Dark
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_indicators=Flip Indicators
windows.wndsettings$uitab.quickslots=Quickslots
windows.wndsettings$uitab.fullscreen=Fullscreen
windows.wndsettings$uitab.system_font=System Font
windows.wndsettings$uitab.key_bindings=Key Bindings
windows.wndsettings$datatab.title=Connectivity Settings

View File

@@ -189,9 +189,9 @@ public class WndSettings extends WndTabbed {
RenderedTextBlock title;
ColorBlock sep1;
CheckBox chkFullscreen;
OptionSlider optScale;
CheckBox chkSaver;
RedButton btnOrientation;
ColorBlock sep2;
OptionSlider optBrightness;
OptionSlider optVisGrid;
@@ -205,6 +205,21 @@ public class WndSettings extends WndTabbed {
sep1 = new ColorBlock(1, 1, 0xFF000000);
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) {
optScale = new OptionSlider(Messages.get(this, "scale"),
(int)Math.ceil(2* Game.density)+ "X",
@@ -252,18 +267,6 @@ public class WndSettings extends WndTabbed {
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);
add(sep2);
@@ -300,25 +303,23 @@ public class WndSettings extends WndTabbed {
bottom = sep1.y + 1;
if (optScale != null){
optScale.setRect(0, bottom + GAP, width, SLIDER_HEIGHT);
bottom = optScale.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();
if (width > 200 && chkSaver != null) {
chkFullscreen.setRect(0, bottom + GAP, width/2-1, BTN_HEIGHT);
chkSaver.setRect(chkFullscreen.right()+ GAP, bottom + GAP, width/2-1, BTN_HEIGHT);
bottom = chkFullscreen.bottom();
} else {
chkFullscreen.setRect(0, bottom + GAP, width, BTN_HEIGHT);
bottom = chkFullscreen.bottom();
if (chkSaver != null) {
chkSaver.setRect(0, bottom + GAP, width, BTN_HEIGHT);
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);
@@ -347,7 +348,6 @@ public class WndSettings extends WndTabbed {
CheckBox chkFlipToolbar;
CheckBox chkFlipTags;
ColorBlock sep2;
CheckBox chkFullscreen;
CheckBox chkFont;
ColorBlock sep3;
RedButton btnKeyBindings;
@@ -428,17 +428,6 @@ public class WndSettings extends WndTabbed {
sep2 = new ColorBlock(1, 1, 0xFF000000);
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")){
@Override
protected void onClick() {
@@ -493,19 +482,16 @@ public class WndSettings extends WndTabbed {
if (width > 200) {
chkFlipToolbar.setRect(0, btnGrouped.bottom() + GAP, 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 {
chkFlipToolbar.setRect(0, btnGrouped.bottom() + GAP, width, BTN_HEIGHT);
chkFlipTags.setRect(0, chkFlipToolbar.bottom() + GAP, width, BTN_HEIGHT);
sep2.size(width, 1);
sep2.y = chkFlipTags.bottom() + 2;
chkFullscreen.setRect(0, sep2.y + 1 + GAP, width, BTN_HEIGHT);
chkFont.setRect(0, chkFullscreen.bottom() + GAP, width, BTN_HEIGHT);
}
sep2.size(width, 1);
sep2.y = chkFlipTags.bottom() + 2;
chkFont.setRect(0, sep2.y + 1 + GAP, width, BTN_HEIGHT);
if (btnKeyBindings != null){
sep3.size(width, 1);
sep3.y = chkFont.bottom() + 2;