v0.4.3a: game now defaults to landscape on appropriate tablets
This commit is contained in:
parent
64087bf3ed
commit
a6852b1b97
|
@ -31,7 +31,7 @@
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:name=".ShatteredPixelDungeon"
|
android:name=".ShatteredPixelDungeon"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
android:screenOrientation="sensorPortrait">
|
android:screenOrientation="nosensor">
|
||||||
<intent-filter >
|
<intent-filter >
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
|
|
@ -58,6 +58,10 @@ enum Preferences {
|
||||||
return prefs;
|
return prefs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean contains( String key ){
|
||||||
|
return get().contains( key );
|
||||||
|
}
|
||||||
|
|
||||||
int getInt( String key, int defValue ) {
|
int getInt( String key, int defValue ) {
|
||||||
return getInt(key, defValue, Integer.MIN_VALUE, Integer.MAX_VALUE);
|
return getInt(key, defValue, Integer.MIN_VALUE, Integer.MAX_VALUE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,16 +171,19 @@ public class ShatteredPixelDungeon extends Game {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
updateImmersiveMode();
|
updateImmersiveMode();
|
||||||
|
|
||||||
DisplayMetrics metrics = new DisplayMetrics();
|
|
||||||
if (immersed() && Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR1)
|
|
||||||
getWindowManager().getDefaultDisplay().getRealMetrics( metrics );
|
|
||||||
else
|
|
||||||
getWindowManager().getDefaultDisplay().getMetrics( metrics );
|
|
||||||
boolean landscape = metrics.widthPixels > metrics.heightPixels;
|
|
||||||
|
|
||||||
if (Preferences.INSTANCE.getBoolean( Preferences.KEY_LANDSCAPE, false ) != landscape) {
|
if (Preferences.INSTANCE.contains( Preferences.KEY_LANDSCAPE )){
|
||||||
landscape( !landscape );
|
landscape ( Preferences.INSTANCE.getBoolean( Preferences.KEY_LANDSCAPE, false));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
DisplayMetrics metrics = new DisplayMetrics();
|
||||||
|
if (immersed() && Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR1)
|
||||||
|
getWindowManager().getDefaultDisplay().getRealMetrics( metrics );
|
||||||
|
else
|
||||||
|
getWindowManager().getDefaultDisplay().getMetrics( metrics );
|
||||||
|
boolean landscape = metrics.widthPixels > metrics.heightPixels;
|
||||||
|
|
||||||
|
landscape( landscape );
|
||||||
}
|
}
|
||||||
|
|
||||||
Music.INSTANCE.enable( music() );
|
Music.INSTANCE.enable( music() );
|
||||||
|
|
Loading…
Reference in New Issue
Block a user