diff --git a/SPD-classes/src/main/java/com/watabou/input/InputHandler.java b/SPD-classes/src/main/java/com/watabou/input/InputHandler.java index 2bc99b4ed..e19aed69f 100644 --- a/SPD-classes/src/main/java/com/watabou/input/InputHandler.java +++ b/SPD-classes/src/main/java/com/watabou/input/InputHandler.java @@ -33,36 +33,7 @@ public class InputHandler extends InputAdapter { private InputMultiplexer multiplexer; public InputHandler( Input input ){ - //An input multiplexer, with additional coord tweaks for power saver mode - multiplexer = new InputMultiplexer(){ - @Override - public boolean touchDown(int screenX, int screenY, int pointer, int button) { - screenX /= (Game.dispWidth / (float)Game.width); - screenY /= (Game.dispHeight / (float)Game.height); - return super.touchDown(screenX, screenY, pointer, button); - } - - @Override - public boolean touchDragged(int screenX, int screenY, int pointer) { - screenX /= (Game.dispWidth / (float)Game.width); - screenY /= (Game.dispHeight / (float)Game.height); - return super.touchDragged(screenX, screenY, pointer); - } - - @Override - public boolean touchUp(int screenX, int screenY, int pointer, int button) { - screenX /= (Game.dispWidth / (float)Game.width); - screenY /= (Game.dispHeight / (float)Game.height); - return super.touchUp(screenX, screenY, pointer, button); - } - - @Override - public boolean mouseMoved(int screenX, int screenY) { - screenX /= (Game.dispWidth / (float)Game.width); - screenY /= (Game.dispHeight / (float)Game.height); - return super.mouseMoved(screenX, screenY); - } - }; + multiplexer = new InputMultiplexer(); input.setInputProcessor(multiplexer); addInputProcessor(this); input.setCatchKey( Input.Keys.BACK, true); diff --git a/SPD-classes/src/main/java/com/watabou/noosa/Game.java b/SPD-classes/src/main/java/com/watabou/noosa/Game.java index a23c0bcd6..884199aec 100644 --- a/SPD-classes/src/main/java/com/watabou/noosa/Game.java +++ b/SPD-classes/src/main/java/com/watabou/noosa/Game.java @@ -21,7 +21,6 @@ package com.watabou.noosa; -import com.badlogic.gdx.Application; import com.badlogic.gdx.ApplicationListener; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.controllers.Controllers; @@ -46,10 +45,6 @@ import java.io.StringWriter; public class Game implements ApplicationListener { public static Game instance; - - //actual size of the display - public static int dispWidth; - public static int dispHeight; // Size of the EGL surface view public static int width; @@ -93,13 +88,12 @@ public class Game implements ApplicationListener { @Override public void create() { - dispHeight = Gdx.graphics.getDisplayMode().height; - dispWidth = Gdx.graphics.getDisplayMode().width; - density = Gdx.graphics.getDensity(); if (density == Float.POSITIVE_INFINITY){ density = 100f / 160f; //assume 100PPI if density can't be found } else if (DeviceCompat.isDesktop()) { + int dispWidth = Gdx.graphics.getDisplayMode().width; + int dispHeight = Gdx.graphics.getDisplayMode().height; float reportedWidth = dispWidth / Gdx.graphics.getPpiX(); float reportedHeight = dispHeight / Gdx.graphics.getPpiY(); @@ -148,12 +142,6 @@ public class Game implements ApplicationListener { Game.width = width; Game.height = height; - //TODO might be better to put this in platform support - if (Gdx.app.getType() != Application.ApplicationType.Android){ - Game.dispWidth = Game.width; - Game.dispHeight = Game.height; - } - resetScene(); } } diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index 8fce7ddfa..f05d11a62 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -12,8 +12,7 @@ - + = 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; - float renderHeight = dispRatio > 1 ? PixelScene.MIN_HEIGHT_L : PixelScene.MIN_HEIGHT_P; - - if (SPDSettings.powerSaver() && fullscreen){ - - int maxZoom = (int)Math.min(Game.dispWidth/renderWidth, Game.dispHeight/renderHeight); - - renderWidth *= Math.max( 2, Math.round(1f + maxZoom*0.4f)); - renderHeight *= Math.max( 2, Math.round(1f + maxZoom*0.4f)); - - if (dispRatio > renderWidth / renderHeight){ - renderWidth = renderHeight * dispRatio; - } else { - renderHeight = renderWidth / dispRatio; - } - - final int finalW = Math.round(renderWidth); - final int finalH = Math.round(renderHeight); - if (finalW != Game.width || finalH != Game.height){ - - AndroidLauncher.instance.runOnUiThread(new Runnable() { - @Override - public void run() { - view.getHolder().setFixedSize(finalW, finalH); - } - }); - - } - } else { - AndroidLauncher.instance.runOnUiThread(new Runnable() { - @Override - public void run() { - view.getHolder().setSizeFromLayout(); - } - }); - } + //TODO seem to be existing bugs with handling split screen here, should look into that } public void updateSystemUI() { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDSettings.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDSettings.java index 13cb344b9..9473690e1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDSettings.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDSettings.java @@ -51,7 +51,6 @@ public class SPDSettings extends GameSettings { public static final String KEY_FULLSCREEN = "fullscreen"; public static final String KEY_LANDSCAPE = "landscape"; - public static final String KEY_POWER_SAVER = "power_saver"; public static final String KEY_ZOOM = "zoom"; public static final String KEY_BRIGHTNESS = "brightness"; public static final String KEY_GRID = "visual_grid"; @@ -83,15 +82,6 @@ public class SPDSettings extends GameSettings { } } - public static void powerSaver( boolean value ){ - put( KEY_POWER_SAVER, value ); - ((ShatteredPixelDungeon)ShatteredPixelDungeon.instance).updateDisplaySize(); - } - - public static boolean powerSaver(){ - return getBoolean( KEY_POWER_SAVER, false ); - } - public static void zoom( int value ) { put( KEY_ZOOM, value ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/PixelScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/PixelScene.java index 1f20c57ae..2f7b06e78 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/PixelScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/PixelScene.java @@ -78,7 +78,6 @@ public class PixelScene extends Scene { public static int defaultZoom = 0; public static int maxDefaultZoom = 0; - public static int maxScreenZoom = 0; public static float minZoom; public static float maxZoom; @@ -122,7 +121,7 @@ public class PixelScene extends Scene { } maxDefaultZoom = (int)Math.min(Game.width/minWidth, Game.height/minHeight); - maxScreenZoom = (int)Math.min(Game.dispWidth/minWidth, Game.dispHeight/minHeight); + maxDefaultZoom = Math.max(2, maxDefaultZoom); defaultZoom = SPDSettings.scale(); if (defaultZoom < Math.ceil( Game.density * 2 ) || defaultZoom > maxDefaultZoom){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java index db1702303..608e2415a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndSettings.java @@ -221,7 +221,6 @@ public class WndSettings extends WndTabbed { ColorBlock sep1; CheckBox chkFullscreen; OptionSlider optScale; - CheckBox chkSaver; RedButton btnOrientation; ColorBlock sep2; OptionSlider optBrightness; @@ -253,39 +252,7 @@ public class WndSettings extends WndTabbed { } add(chkFullscreen); - //power saver is being slowly phased out, only show it on old (4.3-) android devices - // this is being phased out as the setting is useless on all but very old devices anyway - // and support is going to be dropped for 4.3- in the forseeable future - if (DeviceCompat.isAndroid() && PixelScene.maxScreenZoom >= 2 - && (SPDSettings.powerSaver() || !DeviceCompat.supportsFullScreen())) { - chkSaver = new CheckBox(Messages.get(this, "saver")) { - @Override - protected void onClick() { - super.onClick(); - if (checked()) { - checked(!checked()); - ShatteredPixelDungeon.scene().add(new WndOptions(Icons.get(Icons.DISPLAY), - Messages.get(DisplayTab.class, "saver"), - Messages.get(DisplayTab.class, "saver_desc"), - Messages.get(DisplayTab.class, "okay"), - Messages.get(DisplayTab.class, "cancel")) { - @Override - protected void onSelect(int index) { - if (index == 0) { - checked(!checked()); - SPDSettings.powerSaver(checked()); - } - } - }); - } else { - SPDSettings.powerSaver(checked()); - } - } - }; - chkSaver.checked( SPDSettings.powerSaver() ); - add( chkSaver ); - } - + //TODO change to respect auto-rotation when updating Android SDK? if (DeviceCompat.isAndroid()) { Boolean landscape = SPDSettings.landscape(); if (landscape == null){ @@ -359,19 +326,8 @@ public class WndSettings extends WndTabbed { bottom = sep1.y + 1; - 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(); - } - } + chkFullscreen.setRect(0, bottom + GAP, width, BTN_HEIGHT); + bottom = chkFullscreen.bottom(); if (btnOrientation != null) { btnOrientation.setRect(0, bottom + GAP, width, BTN_HEIGHT); diff --git a/ios/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ios/IOSPlatformSupport.java b/ios/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ios/IOSPlatformSupport.java index f9e8ef198..6ec13921b 100644 --- a/ios/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ios/IOSPlatformSupport.java +++ b/ios/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ios/IOSPlatformSupport.java @@ -74,10 +74,8 @@ public class IOSPlatformSupport extends PlatformSupport { int insetChange = Gdx.graphics.getSafeInsetBottom() - Game.bottomInset; Game.bottomInset = Gdx.graphics.getSafeInsetBottom(); Game.height -= insetChange; - Game.dispHeight = Game.height; } else { Game.height += Game.bottomInset; - Game.dispHeight = Game.height; Game.bottomInset = 0; } Gdx.gl.glViewport(0, Game.bottomInset, Game.width, Game.height);