gamnit: fix X position of first char of a TextSprites
authorAlexis Laferrière <alexis.laf@xymus.net>
Sat, 29 Apr 2017 12:56:38 +0000 (08:56 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Mon, 1 May 2017 14:40:52 +0000 (10:40 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/gamnit/tileset.nit

index 67bd32c..f932f61 100644 (file)
@@ -157,12 +157,12 @@ class TextSprites
                if text == null then return
 
                # Build new sprites
-               var dx = font.vspace.to_f/2.0
+               var dx = font.advance/2.0
                var dy = font.hspace.to_f/2.0
                for c in text do
                        if c == '\n' then
                                dy -= font.height.to_f + font.vspace.to_f
-                               dx = font.vspace.to_f/2.0
+                               dx = font.advance/2.0
                                continue
                        else if c.is_whitespace then
                                dx += font.advance