android: intro `App::paused` and use it in mnit
authorAlexis Laferrière <alexis.laf@xymus.net>
Thu, 5 Jun 2014 15:11:36 +0000 (11:11 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Thu, 5 Jun 2014 15:13:05 +0000 (11:13 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/android/android.nit
lib/mnit_android/android_app.nit

index b10bfbf..f3a607b 100644 (file)
@@ -47,4 +47,31 @@ redef class App
                super
                window_closing
        end
+
+       # Is the application currently paused?
+       var paused = true
+
+       redef fun window_created
+       do
+               super
+               paused = false
+       end
+
+       redef fun window_closing
+       do
+               paused = true
+               super
+       end
+
+       redef fun pause
+       do
+               paused = true
+               super
+       end
+
+       redef fun resume
+       do
+               paused = false
+               super
+       end
 end
index 18b7430..b9dbc3e 100644 (file)
@@ -274,6 +274,8 @@ redef class App
                app_glue->onInputEvent = mnit_handle_input;
        `}
 
+       redef fun full_frame do if not paused then super
+
        # these are used as a callback from native to type incoming events
        private fun extern_input_key(event: AndroidKeyEvent): Bool
        do