OSDN Git Service

[experimental] resume in AndroidGraphics.surfaceCreated(). Let's see how that sucker...
authorbadlogicgames <badlogicgames@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Mon, 15 Nov 2010 10:35:33 +0000 (10:35 +0000)
committerbadlogicgames <badlogicgames@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Mon, 15 Nov 2010 10:35:33 +0000 (10:35 +0000)
backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/AndroidApplication.java
backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/AndroidGraphics.java

index 57fdc31..ffa4f07 100644 (file)
@@ -152,7 +152,8 @@ public class AndroidApplication extends Activity implements Application {
                super.onPause();        \r
        }\r
 \r
-       @Override protected void onResume () {          \r
+       @Override protected void onResume () {\r
+               super.onResume();\r
                Gdx.app = this;\r
                Gdx.input = this.getInput();\r
                Gdx.audio = this.getAudio();\r
@@ -164,12 +165,8 @@ public class AndroidApplication extends Activity implements Application {
                        if (graphics.view instanceof android.opengl.GLSurfaceView) ((android.opengl.GLSurfaceView)graphics.view).onResume();\r
                }                       \r
 \r
-               if (audio != null) audio.resume();              \r
-               if(!firstResume)\r
-                       graphics.resume();\r
-               else\r
-                       firstResume=false;\r
-               super.onResume();\r
+               if (audio != null) \r
+                       audio.resume();         \r
        }\r
 \r
        @Override protected void onDestroy () {\r
index 2379183..756c977 100644 (file)
@@ -281,17 +281,15 @@ public final class AndroidGraphics implements Graphics, Renderer {
                        synchronized(this) {\r
                                running = true;\r
                        }\r
-               }\r
-       }\r
-       \r
-       Object synch = new Object();    \r
-       void resume () {\r
-               synchronized(synch) {\r
+               } else {\r
+                       app.listener.resume();\r
                        running = false;\r
                        resume = true;\r
                }\r
+                       \r
        }\r
        \r
+       Object synch = new Object();    \r
        void pause () {\r
                synchronized(synch) {\r
                        running = false;        \r
@@ -334,12 +332,6 @@ public final class AndroidGraphics implements Graphics, Renderer {
                                pause = false;\r
                        }\r
 \r
-                       if (resume) {\r
-                               app.listener.resume();\r
-                               resume = false;\r
-                               running = true;\r
-                       }\r
-\r
                        if (destroy) {\r
                                app.listener.dispose();\r
                                destroy = false;\r