v0.3.3: added the ability to flip the screen in landscape/portrait
This commit is contained in:
parent
078de8d91d
commit
aff724c8d5
|
@ -29,7 +29,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="portrait">
|
android:screenOrientation="sensorPortrait">
|
||||||
<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" />
|
||||||
|
|
|
@ -207,9 +207,15 @@ public class ShatteredPixelDungeon extends Game {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static void landscape( boolean value ) {
|
public static void landscape( boolean value ) {
|
||||||
Game.instance.setRequestedOrientation( value ?
|
if (android.os.Build.VERSION.SDK_INT >= 9) {
|
||||||
|
Game.instance.setRequestedOrientation(value ?
|
||||||
|
ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE :
|
||||||
|
ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
|
||||||
|
} else {
|
||||||
|
Game.instance.setRequestedOrientation(value ?
|
||||||
ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE :
|
ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE :
|
||||||
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT );
|
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
|
}
|
||||||
Preferences.INSTANCE.put( Preferences.KEY_LANDSCAPE, value );
|
Preferences.INSTANCE.put( Preferences.KEY_LANDSCAPE, value );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user