From 656fa6eb72b5f5ae4388f393187260782f8b2bff Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Tue, 19 Jan 2016 14:06:02 -0500 Subject: [PATCH] lib/gamnit depth&flat: extract implementations of frame_core_draw MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- lib/gamnit/depth/depth.nit | 10 ++++++---- lib/gamnit/flat.nit | 5 ++++- 2 files changed, 10 insertions(+), 5 deletions(-) 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 -- 1.7.9.5