v0.8.0: added window size/fullscreen support to desktop, refactored landscape code
This commit is contained in:
@@ -70,12 +70,10 @@ public class AndroidGame extends AndroidApplication {
|
||||
SPDSettings.set(instance.getPreferences("ShatteredPixelDungeon"));
|
||||
|
||||
//set desired orientation (if it exists) before initializing the app.
|
||||
if (SPDSettings.landscapeFromSettings() != null) {
|
||||
if (SPDSettings.landscapeFromSettings()){
|
||||
instance.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
|
||||
} else {
|
||||
instance.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
|
||||
}
|
||||
if (SPDSettings.landscape() != null) {
|
||||
AndroidGame.instance.setRequestedOrientation( SPDSettings.landscape() ?
|
||||
ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE :
|
||||
ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT );
|
||||
}
|
||||
|
||||
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
|
||||
|
||||
@@ -45,11 +45,11 @@ import java.util.regex.Pattern;
|
||||
public class AndroidPlatformSupport extends PlatformSupport {
|
||||
|
||||
public void updateDisplaySize(){
|
||||
boolean landscape = SPDSettings.landscape();
|
||||
|
||||
AndroidGame.instance.setRequestedOrientation(landscape ?
|
||||
ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE :
|
||||
ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
|
||||
if (SPDSettings.landscape() != null) {
|
||||
AndroidGame.instance.setRequestedOrientation( SPDSettings.landscape() ?
|
||||
ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE :
|
||||
ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT );
|
||||
}
|
||||
|
||||
if (AndroidGame.view.getMeasuredWidth() == 0 || AndroidGame.view.getMeasuredHeight() == 0)
|
||||
return;
|
||||
@@ -57,7 +57,7 @@ public class AndroidPlatformSupport extends PlatformSupport {
|
||||
Game.dispWidth = AndroidGame.view.getMeasuredWidth();
|
||||
Game.dispHeight = AndroidGame.view.getMeasuredHeight();
|
||||
|
||||
if ((Game.dispWidth > Game.dispHeight) != landscape){
|
||||
if ((Game.dispWidth >= Game.dispHeight) != PixelScene.landscape()){
|
||||
int tmp = Game.dispWidth;
|
||||
Game.dispWidth = Game.dispHeight;
|
||||
Game.dispHeight = tmp;
|
||||
|
||||
@@ -71,14 +71,14 @@ public class WndAndroidTextInput extends Window {
|
||||
super();
|
||||
|
||||
//need to offset to give space for the soft keyboard
|
||||
if (SPDSettings.landscape()) {
|
||||
if (PixelScene.landscape()) {
|
||||
offset( multiLine ? -45 : -45 );
|
||||
} else {
|
||||
offset( multiLine ? -60 : -45 );
|
||||
}
|
||||
|
||||
final int width;
|
||||
if (SPDSettings.landscape() && multiLine){
|
||||
if (PixelScene.landscape() && multiLine){
|
||||
width = W_LAND_MULTI; //more editing space for landscape users
|
||||
} else {
|
||||
width = WIDTH;
|
||||
|
||||
Reference in New Issue
Block a user