Skip to content

Commit

Permalink
Fix a crash on Android when starting in landscape mode (related to #9)
Browse files Browse the repository at this point in the history
  • Loading branch information
SerGreen committed Mar 25, 2023
1 parent 37cc57c commit 76e66ed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion TWP Android/Properties/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.sergreen.thewitnesspuzzles" android:versionName="1.0.12" android:installLocation="preferExternal" android:versionCode="13">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.sergreen.thewitnesspuzzles" android:versionName="1.0.12a" android:installLocation="preferExternal" android:versionCode="14">
<uses-sdk android:targetSdkVersion="31" />
<application android:label="The Witness Puzzles" android:icon="@drawable/Icon"></application>
</manifest>
4 changes: 4 additions & 0 deletions TWP Shared/TWPGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ public TWPGame()
private void ResizeScreen(object sender, EventArgs e)
{
#if ANDROID
// When the game launches in the landscape mode it calls ResizeScreen before GraphicsDevice gets initialized
if (GraphicsDevice == null || graphics == null)
return;

// On my andoird 4.0.3 i have weird behaviour when backbuffer is automatically being resized wrong
// So i update it manually, TitleSafeArea has the right size of the free screeen area
graphics.PreferredBackBufferWidth = GraphicsDevice.DisplayMode.TitleSafeArea.Width;
Expand Down

0 comments on commit 76e66ed

Please sign in to comment.