gamnit: differentiate create_display and recreate_gamnit from create_gamnit
authorAlexis Laferrière <alexis.laf@xymus.net>
Fri, 3 Nov 2017 18:49:28 +0000 (14:49 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Wed, 17 Jan 2018 17:38:40 +0000 (12:38 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/gamnit/gamnit.nit
lib/gamnit/gamnit_linux.nit

index 8f60056..a21ffe9 100644 (file)
@@ -33,7 +33,16 @@ redef class App
        #
        # The gamnit services redefine this method to prepare optimizations and more.
        # Clients may also refine this method to prepare custom OpenGL resources.
-       fun create_gamnit
+       fun create_gamnit do end
+
+       # Hook to prepare for recreating the OpenGL context
+       #
+       # Some gamnit services refine this method to reset caches before the
+       # next call to `create_gamnit`.
+       fun recreate_gamnit do end
+
+       # Create and set `self.display`
+       fun create_display
        do
                var display = new GamnitDisplay
                display.setup
index 3818878..7dd853a 100644 (file)
@@ -50,6 +50,7 @@ redef class App
        redef fun on_create
        do
                super
+               create_display
                create_gamnit
                create_scene
        end