-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3356 from Ghabry/android-screenfix
Android: Properly handle rotations
- Loading branch information
Showing
4 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
builds/android/app/src/main/java/org/easyrpg/player/player/EasyRpgSurface.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.easyrpg.player.player; | ||
|
||
import android.content.Context; | ||
import android.view.SurfaceHolder; | ||
|
||
import org.libsdl.app.SDLSurface; | ||
|
||
public class EasyRpgSurface extends SDLSurface { | ||
private EasyRpgPlayerActivity activity = null; | ||
|
||
public EasyRpgSurface(Context context, EasyRpgPlayerActivity activity) { | ||
super(context); | ||
|
||
this.activity = activity; | ||
} | ||
|
||
@Override | ||
public void surfaceChanged(SurfaceHolder holder, | ||
int format, int width, int height) { | ||
// configurationChanged is not always sent because of Android bugs in various versions | ||
// SDL uses the surfaceChanged event to detect rotations instead | ||
super.surfaceChanged(holder, format, width, height); | ||
|
||
activity.updateScreenPosition(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters