From: Florian Forster Date: Sat, 30 Jan 2010 10:52:11 +0000 (+0000) Subject: Bug 560: Fix 1-pixel gaps between tiles near hidden areas. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=ec643f2c42dc674ba042e3539eeac29204de664e;p=supertux.git Bug 560: Fix 1-pixel gaps between tiles near hidden areas. Resolves #560. Thanks to Matt McCutchen for this patch. SVN-Revision: 6292 --- diff --git a/src/object/tilemap.cpp b/src/object/tilemap.cpp index d916e055c..4a144e639 100644 --- a/src/object/tilemap.cpp +++ b/src/object/tilemap.cpp @@ -200,12 +200,14 @@ TileMap::draw(DrawingContext& context) if(drawing_effect != 0) context.set_drawing_effect(drawing_effect); if(current_alpha != 1.0) context.set_alpha(current_alpha); - if(!solid) { - float trans_x = roundf(context.get_translation().x); - float trans_y = roundf(context.get_translation().y); - context.set_translation(Vector(int(trans_x * speed_x), - int(trans_y * speed_y))); - } + /* Force the translation to be an integer so that the tiles appear sharper. + * For consistency (i.e., to avoid 1-pixel gaps), this needs to be done even + * for solid tilemaps that are guaranteed to have speed 1. + * FIXME Force integer translation for all graphics, not just tilemaps. */ + float trans_x = roundf(context.get_translation().x); + float trans_y = roundf(context.get_translation().y); + context.set_translation(Vector(int(trans_x * speed_x), + int(trans_y * speed_y))); int tsx = int((context.get_translation().x - x_offset) / 32); // tilestartindex x int tsy = int((context.get_translation().y - y_offset) / 32); // tilestartindex y