X-Git-Url: http://nitlanguage.org diff --git a/lib/gamnit/flat.nit b/lib/gamnit/flat.nit index 06ac8df..45d1ce9 100644 --- a/lib/gamnit/flat.nit +++ b/lib/gamnit/flat.nit @@ -52,7 +52,7 @@ class Sprite # Position of this sprite in world coordinates var center: Point3d[Float] is writable - # Rotation on the Z axis + # Rotation on the Z axis, where 0.0 points right and `0.5*pi` points up var rotation = 0.0 is writable # Mirror `texture` horizontally, inverting each pixel on the X axis @@ -83,7 +83,7 @@ class Sprite 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.translation.uniform(center.x, center.y, center.z, 0.0) simple_2d_program.color.uniform(tint[0], tint[1], tint[2], tint[3]) simple_2d_program.scale.uniform scale @@ -95,7 +95,7 @@ class Sprite else texture.texture_coords, 2) simple_2d_program.coord.array(texture.vertices, 3) - simple_2d_program.rotation.uniform new Matrix.rotation(rotation, 0.0, 0.0, 1.0) + simple_2d_program.rotation.uniform new Matrix.rotation(rotation, 0.0, 0.0, -1.0) glDrawArrays(gl_TRIANGLE_STRIP, 0, 4) end @@ -128,7 +128,7 @@ redef class App # UI sprites to draw in reference to `ui_camera`, over world `sprites` var ui_sprites: Sequence[Sprite] = new List[Sprite] - private var clock = new Clock + private var clock = new Clock is lazy redef fun on_create do @@ -166,12 +166,11 @@ redef class App # Prepare to draw for tex in all_root_textures do tex.load + gamnit_error = tex.error + if gamnit_error != null then print_error gamnit_error glTexParameteri(gl_TEXTURE_2D, gl_TEXTURE_MIN_FILTER, gl_LINEAR) glTexParameteri(gl_TEXTURE_2D, gl_TEXTURE_MAG_FILTER, gl_LINEAR) - - gamnit_error = tex.error - assert gamnit_error == null else print_error gamnit_error end end