/** * Called by onResume or surfaceCreated. An actual resume should be done only when the surface is * ready. Note: Some Android variants may send multiple surfaceChanged events, so we don't need to * resume every time we get one of those events, only if it comes after surfaceDestroyed */ public static void handleResume() { if (SDLActivity.mIsPaused && SDLActivity.mIsSurfaceReady && SDLActivity.mHasFocus) { SDLActivity.mIsPaused = false; SDLActivity.nativeResume(); mSurface.enableSensor(Sensor.TYPE_ACCELEROMETER, true); } }
/** * Called by onPause or surfaceDestroyed. Even if surfaceDestroyed is the first to be called, * mIsSurfaceReady should still be set to 'true' during the call to onPause (in a usual scenario). */ public static void handlePause() { if (!SDLActivity.mIsPaused && SDLActivity.mIsSurfaceReady) { SDLActivity.mIsPaused = true; SDLActivity.nativePause(); mSurface.enableSensor(Sensor.TYPE_ACCELEROMETER, false); } }
/** * Called by onResume or surfaceCreated. An actual resume should be done only when the surface is * ready. Note: Some Android variants may send multiple surfaceChanged events, so we don't need to * resume every time we get one of those events, only if it comes after surfaceDestroyed */ public static void handleResume() { if (SDLActivity.mIsPaused && SDLActivity.mIsSurfaceReady && SDLActivity.mHasFocus) { SDLActivity.mIsPaused = false; SDLActivity.nativeResume(); mSurface.handleResume(); } }
// Setup protected void onCreate(Bundle savedInstanceState) { // Log.v("SDL", "onCreate()"); super.onCreate(savedInstanceState); // So we can call stuff from static callbacks mSingleton = this; // Set up the surface mSurface = new SDLSurface(getApplication()); setContentView(mSurface); SurfaceHolder holder = mSurface.getHolder(); holder.setType(SurfaceHolder.SURFACE_TYPE_GPU); }
public static void flipBuffers() { mSurface.flipEGL(); }
public static boolean createGLContext(int majorVersion, int minorVersion) { return mSurface.initEGL(majorVersion, minorVersion); }