X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fobject%2Ftilemap.cpp;h=4a144e63994ad4669331e3eb0490a6ef0a18473f;hb=590460fb3b8ca5c1eb4b7d5787af9d984032cd8d;hp=d916e055c52816933af069177b138dd4c4d0cb1b;hpb=c731c59b3820357436678eac2753bda5a663d9a4;p=supertux.git 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