From 71e8d18e13e252768cd033f4d949118fcce5cf97 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Sun, 24 Jan 2016 11:02:34 -0500 Subject: [PATCH] lib/gamnit flat: intro `show_splash_screen` MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- lib/gamnit/flat.nit | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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 -- 1.7.9.5