Exemple #1
0
void
TitleScreen::update(float dt_sec, const Controller& controller)
{
  ScreenManager::current()->set_speed(0.6f);
  Sector& sector  = m_titlesession->get_current_sector();
  sector.update(dt_sec);

  BIND_SECTOR(sector);
  make_tux_jump();

  // reopen menu if user closed it (so that the app doesn't close when user
  // accidently hit ESC)
  if (!MenuManager::instance().is_active() && !ScreenManager::current()->has_pending_fadeout())
  {
    MenuManager::instance().set_menu(MenuStorage::MAIN_MENU);
  }

  if (LevelSaveState::getLoading())
  {
    std::string worldname = LevelSaveState::get().getWorld();
    if (worldname != "")
    {
      try
      {
        std::unique_ptr<World> world = World::from_directory(worldname);
        GameManager::current()->start_worldmap(*world);
      }
      catch(const std::exception& e)
      {
        log_fatal << "Couldn't load world " << worldname << ": " << e.what() << std::endl;
      }
    }
    LevelSaveState::finishLoading();
  }
}
Exemple #2
0
void
TitleScreen::update(float elapsed_time)
{
  g_screen_manager->set_speed(0.6f);
  Sector* sector  = titlesession->get_current_sector();
  sector->update(elapsed_time);

  make_tux_jump();

  if (Menu* menu = MenuManager::current())
  {
    menu->check_menu();
  }

  // reopen menu if user closed it (so that the app doesn't close when user
  // accidently hit ESC)
  if(MenuManager::current() == 0 && g_screen_manager->has_no_pending_fadeout()) 
  {
    MenuManager::set_current(main_menu.get());
  }
}