From: florianf 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.octo.it/?a=commitdiff_plain;h=590460fb3b8ca5c1eb4b7d5787af9d984032cd8d;p=supertux.git Bug 560: Fix 1-pixel gaps between tiles near hidden areas. Resolves #560. Thanks to Matt McCutchen for this patch. git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@6292 837edb03-e0f3-0310-88ca-d4d4e8b29345 --- 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