v0.7.0a: fixed various issues with screen layout and power saver mode
This commit is contained in:
parent
02e0de6273
commit
06a6116852
|
@ -75,6 +75,8 @@ public class SPDSettings extends GameSettings {
|
||||||
((ShatteredPixelDungeon)ShatteredPixelDungeon.instance).updateDisplaySize();
|
((ShatteredPixelDungeon)ShatteredPixelDungeon.instance).updateDisplaySize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//FIXME in certain multi-window cases this can disagree with the actual screen size
|
||||||
|
//there should be an option to check for landscape the setting, and actual screen size
|
||||||
public static boolean landscape() {
|
public static boolean landscape() {
|
||||||
return getBoolean(KEY_LANDSCAPE, Game.dispWidth > Game.dispHeight);
|
return getBoolean(KEY_LANDSCAPE, Game.dispWidth > Game.dispHeight);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
package com.shatteredpixel.shatteredpixeldungeon;
|
package com.shatteredpixel.shatteredpixeldungeon;
|
||||||
|
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
|
import android.content.res.Configuration;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -251,6 +252,13 @@ public class ShatteredPixelDungeon extends Game {
|
||||||
updateDisplaySize();
|
updateDisplaySize();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
|
super.onConfigurationChanged(newConfig);
|
||||||
|
|
||||||
|
updateDisplaySize();
|
||||||
|
}
|
||||||
|
|
||||||
public void updateDisplaySize(){
|
public void updateDisplaySize(){
|
||||||
boolean landscape = SPDSettings.landscape();
|
boolean landscape = SPDSettings.landscape();
|
||||||
|
@ -267,11 +275,8 @@ public class ShatteredPixelDungeon extends Game {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (view.getMeasuredWidth() == 0 || view.getMeasuredHeight() == 0)
|
dispHeight = getWindow().getWindowManager().getDefaultDisplay().getHeight();
|
||||||
return;
|
dispWidth = getWindow().getWindowManager().getDefaultDisplay().getWidth();
|
||||||
|
|
||||||
dispWidth = view.getMeasuredWidth();
|
|
||||||
dispHeight = view.getMeasuredHeight();
|
|
||||||
|
|
||||||
float dispRatio = dispWidth / (float)dispHeight;
|
float dispRatio = dispWidth / (float)dispHeight;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user