From: Matthias Braun Date: Sun, 30 May 2004 13:54:40 +0000 (+0000) Subject: fix tiles being 1 pixel off their correct position X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=98ac6d97979448a92b5a34021280201829675099;p=supertux.git fix tiles being 1 pixel off their correct position SVN-Revision: 1364 --- diff --git a/src/tilemap.cpp b/src/tilemap.cpp index 6741d742e..45b2bb3c4 100644 --- a/src/tilemap.cpp +++ b/src/tilemap.cpp @@ -20,6 +20,7 @@ #include #include +#include #include "screen/drawing_context.h" #include "level.h" #include "tile.h" @@ -44,8 +45,10 @@ void TileMap::draw(const std::vector& tiles, DrawingContext& context, int layer) { - float start_x = context.get_translation().x; - float start_y = context.get_translation().y; + /** if we don't round here, we'll have a 1 pixel gap on screen sometimes. + * I have no idea why */ + float start_x = roundf(context.get_translation().x); + float start_y = roundf(context.get_translation().y); float end_x = std::min(start_x + screen->w, float(level->width * 32)); float end_y = std::min(start_y + screen->h, float(level->height * 32)); start_x -= int(start_x) % 32;