-
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.
ConfigurationChanged is not sent on all Android versions because of various bugs in the operating system. Instead SurfaceChanged is used which is consistent with what SDL does. Also Window events are not filtered anymore when in the background. This is required on Android, otherwise rotations are lost.
- 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