v0.9.4: reverted removal of orientation control from Android version
This commit is contained in:
parent
ed5d5a56ee
commit
04d8278950
|
@ -39,7 +39,7 @@
|
|||
<activity
|
||||
android:label="${appName}"
|
||||
android:name=".AndroidGame"
|
||||
android:screenOrientation="user"
|
||||
android:screenOrientation="nosensor"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize">
|
||||
</activity>
|
||||
|
||||
|
|
|
@ -89,6 +89,13 @@ 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 (DeviceCompat.legacyDevice()) {
|
||||
|
|
|
@ -55,6 +55,12 @@ 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)
|
||||
|
@ -66,6 +72,13 @@ 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;
|
||||
|
|
|
@ -164,6 +164,8 @@ 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
|
||||
|
|
|
@ -192,6 +192,7 @@ public class WndSettings extends WndTabbed {
|
|||
CheckBox chkFullscreen;
|
||||
OptionSlider optScale;
|
||||
CheckBox chkSaver;
|
||||
RedButton btnOrientation;
|
||||
ColorBlock sep2;
|
||||
OptionSlider optBrightness;
|
||||
OptionSlider optVisGrid;
|
||||
|
@ -267,6 +268,18 @@ public class WndSettings extends WndTabbed {
|
|||
add( chkSaver );
|
||||
}
|
||||
|
||||
if (DeviceCompat.isAndroid()) {
|
||||
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);
|
||||
|
||||
|
@ -317,6 +330,11 @@ public class WndSettings extends WndTabbed {
|
|||
}
|
||||
}
|
||||
|
||||
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();
|
||||
|
|
Loading…
Reference in New Issue
Block a user