Skip to content

Commit

Permalink
better code for SDLActivity.java
Browse files Browse the repository at this point in the history
  • Loading branch information
White Dragon committed Feb 25, 2018
1 parent e240e63 commit 3f7c41c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions engine/android/src/org/libsdl/app/SDLActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,13 @@ protected void onDestroy() {
SDLActivity.nativeQuit();

// Now wait for the SDL thread to quit
if (mSDLThread != null) {
if (SDLActivity.mSDLThread != null) {
try {
mSDLThread.join();
SDLActivity.mSDLThread.join();
} catch(Exception e) {
Log.v("SDL", "Problem stopping thread: " + e);
}
mSDLThread = null;
SDLActivity.mSDLThread = null;

//Log.v("SDL", "Finished waiting for SDL thread");
}
Expand Down Expand Up @@ -558,7 +558,7 @@ public void surfaceDestroyed(SurfaceHolder holder) {
Log.v("SDL", "surfaceDestroyed()");
// Call this *before* setting mIsSurfaceReady to 'false'
if (SDLActivity.wakeLock.isHeld()) SDLActivity.wakeLock.release();
//SDLActivity.handlePause();
SDLActivity.handlePause();
SDLActivity.mIsSurfaceReady = false;
SDLActivity.onNativeSurfaceDestroyed();
}
Expand Down Expand Up @@ -623,14 +623,16 @@ public void surfaceChanged(SurfaceHolder holder,
SDLActivity.mIsSurfaceReady = true;
SDLActivity.onNativeSurfaceChanged();


if (SDLActivity.mSDLThread == null) {
// This is the entry point to the C app.
// Start up the C app thread and enable sensor input for the first time

SDLActivity.mSDLThread = new Thread(new SDLMain(), "SDLThread");
enableSensor(Sensor.TYPE_ACCELEROMETER, false);
SDLActivity.mSDLThread.start();
} else {
if (!SDLActivity.wakeLock.isHeld()) SDLActivity.wakeLock.acquire();
SDLActivity.handleResume();
}
}

Expand Down

0 comments on commit 3f7c41c

Please sign in to comment.