From 96f970037770cbb3005573c799d3f46be85527fa Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Mon, 1 Feb 2016 11:42:18 -0500 Subject: [PATCH] lib/gamnit: invert Y axis so higher values are higher on the screen MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- lib/gamnit/cameras.nit | 6 +++--- lib/gamnit/flat.nit | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/gamnit/cameras.nit b/lib/gamnit/cameras.nit index 0d64395..a1eed2f 100644 --- a/lib/gamnit/cameras.nit +++ b/lib/gamnit/cameras.nit @@ -209,7 +209,7 @@ class UICamera end # Center of the screen, from the point of view of the camera, at z = 0 - fun center: Point3d[Float] do return new Point3d[Float](position.x + width / 2.0, position.y + height / 2.0, 0.0) + fun center: Point3d[Float] do return new Point3d[Float](position.x + width / 2.0, position.y - height / 2.0, 0.0) # Anchor in the top left corner of the screen, at z = 0 fun top_left: Point3d[Float] do return new Point3d[Float](position.x, position.y, 0.0) @@ -218,10 +218,10 @@ class UICamera fun top_right: Point3d[Float] do return new Point3d[Float](position.x + width, position.y, 0.0) # Anchor in the bottom left corner of the screen, at z = 0 - fun bottom_left: Point3d[Float] do return new Point3d[Float](position.x, position.y + height, 0.0) + fun bottom_left: Point3d[Float] do return new Point3d[Float](position.x, position.y - height, 0.0) # Anchor in the bottom right corner of the screen, at z = 0 - fun bottom_right: Point3d[Float] do return new Point3d[Float](position.x + width, position.y + height, 0.0) + fun bottom_right: Point3d[Float] do return new Point3d[Float](position.x + width, position.y - height, 0.0) # TODO cache the anchors and the matrix diff --git a/lib/gamnit/flat.nit b/lib/gamnit/flat.nit index 1936763..b489f1c 100644 --- a/lib/gamnit/flat.nit +++ b/lib/gamnit/flat.nit @@ -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 -- 1.7.9.5