From 7f0cb28c123adf3e2fd084efc0dbc729c34dd4f8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Mon, 10 Nov 2014 16:04:15 -0500 Subject: [PATCH] lib/tileset: use Numerics for `hspace` and `vspace` MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- lib/mnit/tileset.nit | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/mnit/tileset.nit b/lib/mnit/tileset.nit index 568fad5..5bd5d4d 100644 --- a/lib/mnit/tileset.nit +++ b/lib/mnit/tileset.nit @@ -70,11 +70,11 @@ class TileSetFont # Additional space to insert horizontally between characters # A negave value will display tile overlaped - var hspace: Int = 0 is writable + var hspace: Numeric = 0.0 is writable # Additional space to insert vertically between characters # A negave value will display tile overlaped - var vspace: Int = 0 is writable + var vspace: Numeric = 0.0 is writable # The glyph (tile) associated to the caracter `c` according to `chars` # Returns null if `c` is not in `chars` @@ -91,10 +91,11 @@ redef class Display # '\n' are rendered as carriage return fun text(text: String, font: TileSetFont, x, y: Numeric) do + x = x.to_f var cx = x - var cy = y - var sw = font.width + font.hspace - var sh = font.height + font.vspace + var cy = y.to_f + var sw = font.width.to_f + font.hspace.to_f + var sh = font.height.to_f + font.vspace.to_f for c in text.chars do if c == '\n' then cx = x -- 1.7.9.5