From: Alexis Laferrière Date: Tue, 19 Jan 2016 19:06:02 +0000 (-0500) Subject: lib/gamnit depth&flat: extract implementations of frame_core_draw X-Git-Tag: v0.8~12^2~3 X-Git-Url: http://nitlanguage.org lib/gamnit depth&flat: extract implementations of frame_core_draw Signed-off-by: Alexis Laferrière --- diff --git a/lib/gamnit/depth/depth.nit b/lib/gamnit/depth/depth.nit index e17b5af..c2328c6 100644 --- a/lib/gamnit/depth/depth.nit +++ b/lib/gamnit/depth/depth.nit @@ -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 diff --git a/lib/gamnit/flat.nit b/lib/gamnit/flat.nit index eaa5ba8..90cefca 100644 --- a/lib/gamnit/flat.nit +++ b/lib/gamnit/flat.nit @@ -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