lib/gamnit depth&flat: extract implementations of frame_core_draw
authorAlexis Laferrière <alexis.laf@xymus.net>
Tue, 19 Jan 2016 19:06:02 +0000 (14:06 -0500)
committerAlexis Laferrière <alexis.laf@xymus.net>
Tue, 19 Jan 2016 19:53:57 +0000 (14:53 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/gamnit/depth/depth.nit
lib/gamnit/flat.nit

index e17b5af..c2328c6 100644 (file)
@@ -40,11 +40,11 @@ redef class App
                assert gamnit_error == null else print_error gamnit_error
        end
 
-       # Draw all element in `actors`
-       redef fun frame_core_draw(display)
-       do
-               super
+       redef fun frame_core_draw(display) do frame_core_depth display
 
+       # Draw all elements of `actors` and then call `frame_core_flat`
+       protected fun frame_core_depth(display: GamnitDisplay)
+       do
                # Update cameras on both our programs
                versatile_program.use
                versatile_program.mvp.uniform world_camera.mvp_matrix
@@ -57,5 +57,7 @@ redef class App
                                leaf.material.draw(actor, leaf)
                        end
                end
+
+               frame_core_flat display
        end
 end
index eaa5ba8..90cefca 100644 (file)
@@ -179,8 +179,11 @@ redef class App
                assert gl_error == gl_NO_ERROR else print gl_error
        end
 
+       # Draw the whole screen, all `glDraw...` calls should be executed here
+       protected fun frame_core_draw(display: GamnitDisplay) do frame_core_flat display
+
        # Draw sprites in `sprites` and `ui_sprites`
-       protected fun frame_core_draw(display: GamnitDisplay)
+       protected fun frame_core_flat(display: GamnitDisplay)
        do
                simple_2d_program.use