From: Ryan Flegel Date: Fri, 14 May 2004 21:49:30 +0000 (+0000) Subject: - more resolution fixes X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=e776775f2ef6a3843cb83b39b34980d98e208f2f;p=supertux.git - more resolution fixes SVN-Revision: 1182 --- diff --git a/src/gameloop.cpp b/src/gameloop.cpp index 9c52c9f10..251dafdcd 100644 --- a/src/gameloop.cpp +++ b/src/gameloop.cpp @@ -146,7 +146,7 @@ GameSession::levelintro(void) char str[60]; if (get_level()->img_bkgd) - get_level()->img_bkgd->draw(0, 0); + get_level()->draw_bg(); else drawgradient(get_level()->bkgd_top, get_level()->bkgd_bottom); @@ -721,7 +721,7 @@ GameSession::drawendscreen() char str[80]; if (get_level()->img_bkgd) - get_level()->img_bkgd->draw(0, 0); + get_level()->draw_bg(); else drawgradient(get_level()->bkgd_top, get_level()->bkgd_bottom); @@ -745,7 +745,7 @@ GameSession::drawresultscreen(void) char str[80]; if (get_level()->img_bkgd) - get_level()->img_bkgd->draw(0, 0); + get_level()->draw_bg(); else drawgradient(get_level()->bkgd_top, get_level()->bkgd_bottom); diff --git a/src/level.cpp b/src/level.cpp index c8ef15d05..ce2414f28 100644 --- a/src/level.cpp +++ b/src/level.cpp @@ -739,6 +739,16 @@ Level::change(float x, float y, int tm, unsigned int c) } } +void Level::draw_bg() +{ + // Tile background horizontally + int sx = (int)((float)scroll_x * ((float)bkgd_speed/100.0f)) % img_bkgd->w; + for (int i = 0; (i-1)*img_bkgd->w <= screen->w; i++) + img_bkgd->draw_part(i == 0 ? sx : 0, 0, + i == 0 ? 0 : (img_bkgd->w * i) - sx, 0, + i == 0 ? img_bkgd->w - sx : img_bkgd->w, img_bkgd->h); +} + void Level::load_song() { diff --git a/src/level.h b/src/level.h index 3b08ec7ce..0a023a5f6 100644 --- a/src/level.h +++ b/src/level.h @@ -136,6 +136,9 @@ class Level void change_width (int new_width); void change_height (int new_height); + /* Draw background */ + void draw_bg(); + /** Return the id of the tile at position x/y */ unsigned int gettileid(float x, float y) const; /** returns the id of the tile at position x,y diff --git a/src/screen.cpp b/src/screen.cpp index df1b53f0e..fa685b157 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -72,10 +72,10 @@ void drawgradient(Color top_clr, Color bot_clr) glBegin(GL_QUADS); glColor3ub(top_clr.red, top_clr.green, top_clr.blue); glVertex2f(0, 0); - glVertex2f(640, 0); + glVertex2f(screen->w, 0); glColor3ub(bot_clr.red, bot_clr.green, bot_clr.blue); - glVertex2f(640, 480); - glVertex2f(0, 480); + glVertex2f(screen->w, screen->h); + glVertex2f(0, screen->h); glEnd(); } else diff --git a/src/title.cpp b/src/title.cpp index f9e2ef5bc..1425031ae 100644 --- a/src/title.cpp +++ b/src/title.cpp @@ -271,7 +271,7 @@ void title(void) draw_demo(&session, frame_ratio); if (Menu::current() == main_menu) - logo->draw( 160, 30); + logo->draw(screen->w/2 - logo->w/2, 30); white_small_text->draw(" SuperTux " VERSION "\n" "Copyright (c) 2003 SuperTux Devel Team\n" diff --git a/src/world.cpp b/src/world.cpp index bd1cc937a..a62ecd3d9 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -178,21 +178,10 @@ World::draw() int y,x; /* Draw the real background */ + drawgradient(level->bkgd_top, level->bkgd_bottom); if(level->img_bkgd) - { - // 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 - { - drawgradient(level->bkgd_top, level->bkgd_bottom); - } + level->draw_bg(); + /* Draw particle systems (background) */ std::vector::iterator p;