X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fvideo%2Fsurface.cpp;h=c7b1e1bbae98073a4a364cbbf2661673d36bd520;hb=6cd71a8644049d1951b5a9702a57ad02a7971c1e;hp=23ff693897742dcd1ebb6fb27604f265d7b58fe4;hpb=a113d3bd1feddd510e3b2852b0d42522735eee40;p=supertux.git diff --git a/src/video/surface.cpp b/src/video/surface.cpp index 23ff69389..c7b1e1bba 100644 --- a/src/video/surface.cpp +++ b/src/video/surface.cpp @@ -41,8 +41,8 @@ Surface::Surface(const std::string& file) { texture = texture_manager->get(file); texture->ref(); - uv_left = 0; - uv_top = 0; + uv_left = 0.5 / texture->get_width(); + uv_top = 0.5 / texture->get_height(); uv_right = texture->get_uv_right(); uv_bottom = texture->get_uv_bottom(); @@ -57,10 +57,10 @@ Surface::Surface(const std::string& file, int x, int y, int w, int h) float tex_w = static_cast (texture->get_width()); float tex_h = static_cast (texture->get_height()); - uv_left = static_cast(x) / tex_w; - uv_top = static_cast(y) / tex_h; - uv_right = static_cast(x+w) / tex_w; - uv_bottom = static_cast(y+h) / tex_h; + uv_left = static_cast(x+0.5) / tex_w; + uv_top = static_cast(y+0.5) / tex_h; + uv_right = static_cast(x+w-0.5) / tex_w; + uv_bottom = static_cast(y+h-0.5) / tex_h; width = w; height = h;