Merge: nitc: check pkg-config packages availability later
[nit.git] / lib / gamnit / flat / flat_core.nit
index 2ab18f6..ef49d00 100644 (file)
@@ -80,27 +80,27 @@ class Sprite
        var texture: Texture is writable(texture_direct=)
 
        # Texture drawn to screen
-       fun texture=(value: Texture)
+       fun texture=(texture: Texture)
        do
-               if isset _texture and value != texture then
+               if isset _texture and texture != self.texture then
                        needs_update
-                       if value.root != texture.root then needs_remap
+                       if texture.root != self.texture.root then needs_remap
                end
-               texture_direct = value
+               texture_direct = texture
        end
 
        # Center position of this sprite in world coordinates
        var center: Point3d[Float] is writable(center_direct=), noautoinit
 
        # Center position of this sprite in world coordinates
-       fun center=(value: Point3d[Float]) is autoinit do
-               if isset _center and value != center then
+       fun center=(center: Point3d[Float]) is autoinit do
+               if isset _center and center != self.center then
                        needs_update
-                       center.sprites_remove self
+                       self.center.sprites_remove self
                end
 
-               value.sprites_add self
-               center_direct = value
+               center.sprites_add self
+               center_direct = center
        end
 
        # Last animation set with `animate`
@@ -399,6 +399,9 @@ redef class App
                var display = display
                assert display != null
                glClear gl_COLOR_BUFFER_BIT
+
+               ui_camera.reset_height 1080.0
+               glViewport(0, 0, display.width, display.height)
                frame_core_ui_sprites display
                display.flip
 
@@ -473,9 +476,6 @@ redef class App
        do
                super
 
-               # Clean up
-               simple_2d_program.delete
-
                # Close gamnit
                var display = display
                if display != null then display.close
@@ -492,6 +492,12 @@ redef class App
                for sprite in ui_sprites do sprite.needs_update
        end
 
+       redef fun on_resume
+       do
+               clock.lapse
+               super
+       end
+
        redef fun frame_core(display)
        do
                # Check errors
@@ -1753,10 +1759,11 @@ end
 redef class GLfloatArray
        private fun fill_from_matrix(matrix: Matrix, dst_offset: nullable Int)
        do
-               dst_offset = dst_offset or else 0
+               dst_offset = dst_offset or else add_index
                var mat_len = matrix.width*matrix.height
                assert length >= mat_len + dst_offset
                native_array.fill_from_matrix_native(matrix.items, dst_offset, mat_len)
+               add_index += mat_len
        end
 end