From: Alexis Laferrière Date: Sun, 24 Jan 2016 16:02:34 +0000 (-0500) Subject: lib/gamnit flat: intro `show_splash_screen` X-Git-Tag: v0.8~7^2~6 X-Git-Url: http://nitlanguage.org lib/gamnit flat: intro `show_splash_screen` Signed-off-by: Alexis Laferrière --- diff --git a/lib/gamnit/flat.nit b/lib/gamnit/flat.nit index d415ded..b598f01 100644 --- a/lib/gamnit/flat.nit +++ b/lib/gamnit/flat.nit @@ -212,6 +212,27 @@ redef class App # Main method to refine in clients to update game logic and `sprites` fun update(dt: Float) do end + # Display `texture` as a splash screen + # + # Load `texture` if needed and resets `ui_camera` to 1080 units on the Y axis. + fun show_splash_screen(texture: Texture) + do + texture.load + + ui_camera.reset_height 1080.0 + + var splash = new Sprite(texture, ui_camera.center) + ui_sprites.add splash + + var display = display + assert display != null + glClear gl_COLOR_BUFFER_BIT + frame_core_flat display + display.flip + + ui_sprites.remove splash + end + redef fun on_stop do # Clean up