void GameSession::levelintro(void) { music_manager->halt_music(); char str[60]; if (get_level()->img_bkgd) get_level()->img_bkgd->draw(0, 0); else drawgradient(get_level()->bkgd_top, get_level()->bkgd_bottom); sprintf(str, "%s", world->get_level()->name.c_str()); gold_text->drawf(str, 0, 200, A_HMIDDLE, A_TOP, 1); sprintf(str, "TUX x %d", player_status.lives); white_text->drawf(str, 0, 224, A_HMIDDLE, A_TOP, 1); sprintf(str, "by %s", world->get_level()->author.c_str()); white_small_text->drawf(str, 0, 360, A_HMIDDLE, A_TOP, 1); flipscreen(); SDL_Event event; wait_for_event(event,1000,3000,true); }
void GameSession::drawresultscreen(void) { char str[80]; if (get_level()->img_bkgd) get_level()->img_bkgd->draw(0, 0); else drawgradient(get_level()->bkgd_top, get_level()->bkgd_bottom); blue_text->drawf("Result:", 0, 200, A_HMIDDLE, A_TOP, 1); sprintf(str, "SCORE: %d", player_status.score); gold_text->drawf(str, 0, 224, A_HMIDDLE, A_TOP, 1); sprintf(str, "COINS: %d", player_status.distros); gold_text->drawf(str, 0, 256, A_HMIDDLE, A_TOP, 1); flipscreen(); SDL_Event event; wait_for_event(event,2000,5000,true); }
void World::draw() { int y,x; /* 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); } else { drawgradient(level->bkgd_top, level->bkgd_bottom); } /* Draw particle systems (background) */ std::vector<ParticleSystem*>::iterator p; for(p = particle_systems.begin(); p != particle_systems.end(); ++p) { (*p)->draw(scroll_x, 0, 0); } /* Draw background: */ for (y = 0; y < 15; ++y) { for (x = 0; x < 21; ++x) { Tile::draw(32*x - fmodf(scroll_x, 32), y * 32, level->bg_tiles[(int)y][(int)x + (int)(scroll_x / 32)]); } } /* Draw interactive tiles: */ for (y = 0; y < 15; ++y) { for (x = 0; x < 21; ++x) { Tile::draw(32*x - fmodf(scroll_x, 32), y * 32, level->ia_tiles[(int)y][(int)x + (int)(scroll_x / 32)]); } } /* (Bouncy bricks): */ for (unsigned int i = 0; i < bouncy_bricks.size(); ++i) bouncy_bricks[i]->draw(); for (BadGuys::iterator i = bad_guys.begin(); i != bad_guys.end(); ++i) (*i)->draw(); tux.draw(); for (unsigned int i = 0; i < bullets.size(); ++i) bullets[i].draw(); for (unsigned int i = 0; i < floating_scores.size(); ++i) floating_scores[i]->draw(); for (unsigned int i = 0; i < upgrades.size(); ++i) upgrades[i].draw(); for (unsigned int i = 0; i < bouncy_distros.size(); ++i) bouncy_distros[i]->draw(); for (unsigned int i = 0; i < broken_bricks.size(); ++i) broken_bricks[i]->draw(); /* Draw foreground: */ for (y = 0; y < 15; ++y) { for (x = 0; x < 21; ++x) { Tile::draw(32*x - fmodf(scroll_x, 32), y * 32, level->fg_tiles[(int)y][(int)x + (int)(scroll_x / 32)]); } } /* Draw particle systems (foreground) */ for(p = particle_systems.begin(); p != particle_systems.end(); ++p) { (*p)->draw(scroll_x, 0, 1); } }