From: Ryan Flegel Date: Fri, 14 May 2004 20:50:22 +0000 (+0000) Subject: - some resolution fixes X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=fff451d02751ca31538115350a9e1c439e098b64;p=supertux.git - some resolution fixes SVN-Revision: 1181 --- diff --git a/src/defines.h b/src/defines.h index 688266f6b..a33d976d2 100644 --- a/src/defines.h +++ b/src/defines.h @@ -49,9 +49,10 @@ enum DyingType { }; /* Screen-related stuff */ - -#define VISIBLE_TILES_X 25 -#define VISIBLE_TILES_Y 19 +// +1 is needed because when tiles are wrapping around the screen there +// are two partial tiles on the screen +#define VISIBLE_TILES_X 25 +1 +#define VISIBLE_TILES_Y 19 +1 /* Sizes: */ diff --git a/src/world.cpp b/src/world.cpp index 803f1848f..bd1cc937a 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -180,9 +180,14 @@ World::draw() /* Draw the real background */ if(level->img_bkgd) { - int s = (int)((float)scroll_x * ((float)level->bkgd_speed/100.0f)) % screen->w; - level->img_bkgd->draw_part(s, 0,0,0,level->img_bkgd->w - s, level->img_bkgd->h); - level->img_bkgd->draw_part(0, 0,screen->w - s ,0,s,level->img_bkgd->h); + // Tile background horizontally + int sx = (int)((float)scroll_x * ((float)level->bkgd_speed/100.0f)) % level->img_bkgd->w; + for (int i = 0; (i-1)*level->img_bkgd->w <= screen->w; i++) + { + level->img_bkgd->draw_part(i == 0 ? sx : 0, 0, + i == 0 ? 0 : (level->img_bkgd->w * i) - sx, 0, + i == 0 ? level->img_bkgd->w - sx : level->img_bkgd->w, level->img_bkgd->h); + } } else { @@ -340,7 +345,7 @@ void World::scrolling(double frame_ratio) if (scroll_y < 0) { - std::cerr << "Level too short!!" << std::endl; + //std::cerr << "Level too short!!" << std::endl; scroll_y = 0; }