mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
Compare commits
2 Commits
098380ce06
...
a3fa7df1f3
Author | SHA1 | Date | |
---|---|---|---|
|
a3fa7df1f3 | ||
|
dc5869f607 |
@ -29,13 +29,12 @@ import {{.JavaPkg}}.ebitenmobileview.RenderRequester;
|
||||
import {{.JavaPkg}}.{{.PrefixLower}}.EbitenView;
|
||||
|
||||
class EbitenSurfaceView extends GLSurfaceView implements RenderRequester {
|
||||
// As GLSurfaceView can be recreated, the states must be static (#3097).
|
||||
static private boolean errored_ = false;
|
||||
static private boolean onceSurfaceCreated_ = false;
|
||||
static private boolean contextLost_ = false;
|
||||
|
||||
private class EbitenRenderer implements GLSurfaceView.Renderer {
|
||||
|
||||
private boolean errored_ = false;
|
||||
private boolean onceSurfaceCreated_ = false;
|
||||
private boolean contextLost_ = false;
|
||||
|
||||
@Override
|
||||
public void onDrawFrame(GL10 gl) {
|
||||
if (errored_) {
|
||||
@ -100,7 +99,7 @@ class EbitenSurfaceView extends GLSurfaceView implements RenderRequester {
|
||||
}
|
||||
|
||||
private void onContextLost() {
|
||||
Log.v("Go", "Kill the application due to a context lost");
|
||||
Log.e("Go", "The application was killed due to context loss");
|
||||
// TODO: Relaunch this application for better UX (#805).
|
||||
Runtime.getRuntime().exit(0);
|
||||
}
|
||||
|
@ -81,6 +81,8 @@ type userInterfaceImpl struct {
|
||||
initWindowMaximized bool
|
||||
initWindowMousePassthrough bool
|
||||
|
||||
initUnfocused bool
|
||||
|
||||
// bufferOnceSwapped must be accessed from the main thread.
|
||||
bufferOnceSwapped bool
|
||||
|
||||
@ -1087,6 +1089,7 @@ func (u *UserInterface) initOnMainThread(options *RunOptions) error {
|
||||
return err
|
||||
}
|
||||
|
||||
u.initUnfocused = options.InitUnfocused
|
||||
focused := glfw.True
|
||||
if options.InitUnfocused {
|
||||
focused = glfw.False
|
||||
@ -1288,9 +1291,11 @@ func (u *UserInterface) update() (float64, float64, error) {
|
||||
if err = u.window.Show(); err != nil {
|
||||
return
|
||||
}
|
||||
if !u.initUnfocused {
|
||||
if err = u.window.Focus(); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if runtime.GOOS == "darwin" || runtime.GOOS == "windows" {
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user