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);
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);
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);
}
}
+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()
{
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
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
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"
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<ParticleSystem*>::iterator p;