char str[60];
- if (get_level()->img_bkgd)
- get_level()->draw_bg();
- else
- drawgradient(get_level()->bkgd_top, get_level()->bkgd_bottom);
+ get_level()->draw_bg();
sprintf(str, "%s", world->get_level()->name.c_str());
gold_text->drawf(str, 0, 220, A_HMIDDLE, A_TOP, 1);
{
char str[80];
- if (get_level()->img_bkgd)
- get_level()->draw_bg();
- else
- drawgradient(get_level()->bkgd_top, get_level()->bkgd_bottom);
+ get_level()->draw_bg();
blue_text->drawf("Result:", 0, 200, A_HMIDDLE, A_TOP, 1);
void Level::draw_bg()
{
- // Tile background horizontally
- int sx = (int)((float)scroll_x * ((float)bkgd_speed/100.0f)) % img_bkgd->w;
- int sy = (int)((float)scroll_y * ((float)bkgd_speed/100.0f)) % img_bkgd->h;
- for (int x = 0; (x-1)*img_bkgd->w <= screen->w; x++)
- for (int y = 0; (y-1)*img_bkgd->h <= screen->h; y++)
- img_bkgd->draw_part(x == 0 ? sx : 0, y == 0 ? sy : 0,
- x == 0 ? 0 : (img_bkgd->w * x) - sx, y == 0 ? 0 : (img_bkgd->h * y) - sy,
- x == 0 ? img_bkgd->w - sx : img_bkgd->w, y == 0 ? img_bkgd->h - sy : img_bkgd->h);
+ if(img_bkgd)
+ {
+ // Tile background horizontally
+ int sx = (int)((float)scroll_x * ((float)bkgd_speed/100.0f)) % img_bkgd->w;
+ int sy = (int)((float)scroll_y * ((float)bkgd_speed/100.0f)) % img_bkgd->h;
+ for (int x = 0; (x-1)*img_bkgd->w <= screen->w; x++)
+ for (int y = 0; (y-1)*img_bkgd->h <= screen->h; y++)
+ img_bkgd->draw_part(x == 0 ? sx : 0, y == 0 ? sy : 0,
+ x == 0 ? 0 : (img_bkgd->w * x) - sx, y == 0 ? 0 : (img_bkgd->h * y) - sy,
+ x == 0 ? img_bkgd->w - sx : img_bkgd->w, y == 0 ? img_bkgd->h - sy : img_bkgd->h);
+ }
+ else
+ {
+ drawgradient(bkgd_top, bkgd_bottom);
+ }
}
void
Uint8 a;
/* Draw the real background */
- if (le_world->get_level()->img_bkgd)
- le_world->get_level()->draw_bg();
- else
- drawgradient(le_world->get_level()->bkgd_top, le_world->get_level()->bkgd_bottom);
+ le_world->get_level()->draw_bg();
if(le_current.IsTile())
{