coins_at_start(),
bonus_at_start(),
max_fire_bullets_at_start(),
- max_ice_bullets_at_start()
+ max_ice_bullets_at_start(),
+ active(false)
{
if (restart_level() != 0)
throw std::runtime_error ("Initializing the level failed.");
currentStatus->max_ice_bullets = max_ice_bullets_at_start;
}
+bool
+GameSession::is_active() const
+{
+ return !game_pause && active;
+}
+
void
GameSession::set_editmode(bool edit_mode_)
{
int total_stats_to_be_collected = level->stats.total_coins + level->stats.total_badguys + level->stats.total_secrets;
if ((!levelintro_shown) && (total_stats_to_be_collected > 0)) {
levelintro_shown = true;
+ active = false;
ScreenManager::current()->push_screen(std::unique_ptr<Screen>(new LevelIntro(level.get(), best_level_statistics)));
}
}
void
GameSession::update(float elapsed_time)
{
+ // Set active flag
+ if(!active)
+ {
+ active = true;
+ }
// handle controller
if(InputManager::current()->get_controller()->pressed(Controller::ESCAPE) ||
InputManager::current()->get_controller()->pressed(Controller::START))
void toggle_pause();
void abort_level();
+ bool is_active() const;
/**
* Enters or leaves level editor mode
BonusType bonus_at_start; /** What bonuses does the player have at the start */
int max_fire_bullets_at_start; /** How many fire bullets does the player have */
int max_ice_bullets_at_start; /** How many ice bullets does the player have */
+
+ bool active; /** Game active? **/
private:
GameSession(const GameSession&);
break;
case SDL_WINDOWEVENT_FOCUS_LOST:
- if(GameSession::current() != NULL) {
+ if(GameSession::current() != NULL &&
+ GameSession::current()->is_active())
+ {
GameSession::current()->toggle_pause();
}
break;