예제 #1
0
 /**
  * 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);
   }
 }
예제 #2
0
 /**
  * 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);
   }
 }
예제 #3
0
 /**
  * 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();
   }
 }
예제 #4
0
  // 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);
  }
예제 #5
0
 public static void flipBuffers() {
   mSurface.flipEGL();
 }
예제 #6
0
 public static boolean createGLContext(int majorVersion, int minorVersion) {
   return mSurface.initEGL(majorVersion, minorVersion);
 }