mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-20 22:16:49 +01:00
Android: minor, remove static attributes, move mIsSurfaceReady to SDLSurface
This commit is contained in:
parent
647b1f6a6d
commit
ae41831e0d
@ -37,7 +37,7 @@ import android.content.pm.ApplicationInfo;
|
|||||||
public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener {
|
public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener {
|
||||||
private static final String TAG = "SDL";
|
private static final String TAG = "SDL";
|
||||||
|
|
||||||
public static boolean mIsResumedCalled, mIsSurfaceReady, mHasFocus;
|
public static boolean mIsResumedCalled, mHasFocus;
|
||||||
|
|
||||||
// Cursor types
|
// Cursor types
|
||||||
private static final int SDL_SYSTEM_CURSOR_NONE = -1;
|
private static final int SDL_SYSTEM_CURSOR_NONE = -1;
|
||||||
@ -179,7 +179,6 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
|||||||
mSDLThread = null;
|
mSDLThread = null;
|
||||||
mBrokenLibraries = false;
|
mBrokenLibraries = false;
|
||||||
mIsResumedCalled = false;
|
mIsResumedCalled = false;
|
||||||
mIsSurfaceReady = false;
|
|
||||||
mHasFocus = true;
|
mHasFocus = true;
|
||||||
mNextNativeState = NativeState.INIT;
|
mNextNativeState = NativeState.INIT;
|
||||||
mCurrentNativeState = NativeState.INIT;
|
mCurrentNativeState = NativeState.INIT;
|
||||||
@ -497,7 +496,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
|||||||
|
|
||||||
// Try a transition to resumed state
|
// Try a transition to resumed state
|
||||||
if (mNextNativeState == NativeState.RESUMED) {
|
if (mNextNativeState == NativeState.RESUMED) {
|
||||||
if (mIsSurfaceReady && mHasFocus && mIsResumedCalled) {
|
if (mSurface.mIsSurfaceReady && mHasFocus && mIsResumedCalled) {
|
||||||
if (mSDLThread == null) {
|
if (mSDLThread == null) {
|
||||||
// This is the entry point to the C app.
|
// This is the entry point to the C app.
|
||||||
// Start up the C app thread and enable sensor input for the first time
|
// Start up the C app thread and enable sensor input for the first time
|
||||||
@ -1531,11 +1530,14 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
|
|||||||
View.OnKeyListener, View.OnTouchListener, SensorEventListener {
|
View.OnKeyListener, View.OnTouchListener, SensorEventListener {
|
||||||
|
|
||||||
// Sensors
|
// Sensors
|
||||||
protected static SensorManager mSensorManager;
|
protected SensorManager mSensorManager;
|
||||||
protected static Display mDisplay;
|
protected Display mDisplay;
|
||||||
|
|
||||||
// Keep track of the surface size to normalize touch events
|
// Keep track of the surface size to normalize touch events
|
||||||
protected static float mWidth, mHeight;
|
protected float mWidth, mHeight;
|
||||||
|
|
||||||
|
// Is SurfaceView ready for rendering
|
||||||
|
public boolean mIsSurfaceReady;
|
||||||
|
|
||||||
// Startup
|
// Startup
|
||||||
public SDLSurface(Context context) {
|
public SDLSurface(Context context) {
|
||||||
@ -1558,6 +1560,8 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
|
|||||||
// Some arbitrary defaults to avoid a potential division by zero
|
// Some arbitrary defaults to avoid a potential division by zero
|
||||||
mWidth = 1.0f;
|
mWidth = 1.0f;
|
||||||
mHeight = 1.0f;
|
mHeight = 1.0f;
|
||||||
|
|
||||||
|
mIsSurfaceReady = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handlePause() {
|
public void handlePause() {
|
||||||
@ -1593,7 +1597,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
|
|||||||
SDLActivity.mNextNativeState = SDLActivity.NativeState.PAUSED;
|
SDLActivity.mNextNativeState = SDLActivity.NativeState.PAUSED;
|
||||||
SDLActivity.handleNativeState();
|
SDLActivity.handleNativeState();
|
||||||
|
|
||||||
SDLActivity.mIsSurfaceReady = false;
|
mIsSurfaceReady = false;
|
||||||
SDLActivity.onNativeSurfaceDestroyed();
|
SDLActivity.onNativeSurfaceDestroyed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1686,7 +1690,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
|
|||||||
|
|
||||||
if (skip) {
|
if (skip) {
|
||||||
Log.v("SDL", "Skip .. Surface is not ready.");
|
Log.v("SDL", "Skip .. Surface is not ready.");
|
||||||
SDLActivity.mIsSurfaceReady = false;
|
mIsSurfaceReady = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1694,7 +1698,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
|
|||||||
SDLActivity.onNativeSurfaceChanged();
|
SDLActivity.onNativeSurfaceChanged();
|
||||||
|
|
||||||
/* Surface is ready */
|
/* Surface is ready */
|
||||||
SDLActivity.mIsSurfaceReady = true;
|
mIsSurfaceReady = true;
|
||||||
|
|
||||||
SDLActivity.mNextNativeState = SDLActivity.NativeState.RESUMED;
|
SDLActivity.mNextNativeState = SDLActivity.NativeState.RESUMED;
|
||||||
SDLActivity.handleNativeState();
|
SDLActivity.handleNativeState();
|
||||||
|
Loading…
Reference in New Issue
Block a user