glActiveTexture gl_TEXTURE0
glBindTexture(gl_TEXTURE_2D, texture.root.gl_texture)
+ simple_2d_program.translation.array_enabled = false
+ simple_2d_program.color.array_enabled = false
+ simple_2d_program.scale.array_enabled = false
+
simple_2d_program.translation.uniform(center.x, -center.y, center.z, 0.0)
simple_2d_program.color.uniform(1.0, 1.0, 1.0, alpha)
simple_2d_program.scale.uniform scale
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
# 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