#include "supertux/title_screen.hpp"
#include "audio/sound_manager.hpp"
+#include "gui/menu.hpp"
#include "gui/menu_manager.hpp"
#include "lisp/parser.hpp"
#include "object/camera.hpp"
#include "supertux/fadeout.hpp"
#include "supertux/gameconfig.hpp"
#include "supertux/globals.hpp"
-#include "supertux/screen_manager.hpp"
-#include "supertux/menu/addon_menu.hpp"
-#include "supertux/menu/contrib_world_menu.hpp"
-#include "supertux/menu/contrib_menu.hpp"
-#include "supertux/menu/main_menu.hpp"
+#include "supertux/menu/menu_storage.hpp"
#include "supertux/resources.hpp"
+#include "supertux/screen_manager.hpp"
#include "supertux/sector.hpp"
#include "supertux/textscroller.hpp"
#include "supertux/world.hpp"
#include <version.h>
TitleScreen::TitleScreen(PlayerStatus* player_status) :
- main_menu(new MainMenu()),
frame(),
controller(),
titlesession()
player->set_speedlimit(230); //MAX_WALK_XM
frame = Surface::create("images/engine/menu/frame.png");
+ copyright_text = "SuperTux " PACKAGE_VERSION "\n" +
+ _("Copyright") + " (c) 2003-2014 SuperTux Devel Team\n" +
+ _("This game comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to\n"
+ "redistribute it under certain conditions; see the file COPYING for details.\n"
+ );
}
std::string
sector->activate(sector->player->get_pos());
}
- MenuManager::set_current(main_menu.get());
+ MenuManager::instance().set_menu(MenuStorage::MAIN_MENU);
}
void
{
Sector* sector = titlesession->get_current_sector();
sector->deactivate();
- MenuManager::set_current(NULL);
+ MenuManager::instance().clear_menu_stack();
}
void
// FIXME: Add something to scale the frame to the resolution of the screen
//context.draw_surface(frame, Vector(0,0),LAYER_FOREGROUND1);
- context.draw_text(Resources::small_font, "SuperTux " PACKAGE_VERSION "\n",
- Vector(5, SCREEN_HEIGHT - 50), ALIGN_LEFT, LAYER_FOREGROUND1);
context.draw_text(Resources::small_font,
- _(
- "Copyright (c) 2003-2013 SuperTux Devel Team\n"
- "This game comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to\n"
- "redistribute it under certain conditions; see the file COPYING for details.\n"
- ),
- Vector(5, SCREEN_HEIGHT - 50 + Resources::small_font->get_height() + 5),
+ copyright_text,
+ Vector(5, SCREEN_HEIGHT - 50),
ALIGN_LEFT, LAYER_FOREGROUND1);
}
make_tux_jump();
- if (Menu* menu = MenuManager::current())
+ if (Menu* menu = MenuManager::instance().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());
- }
-}
-
-void
-TitleScreen::start_game(World* world)
-{
- MenuManager::set_current(NULL);
-
- std::string basename = world->get_basedir();
- basename = basename.substr(0, basename.length()-1);
- std::string worlddirname = FileSystem::basename(basename);
- std::ostringstream stream;
- stream << "profile" << g_config->profile << "/" << worlddirname << ".stsg";
- std::string slotfile = stream.str();
-
- try
- {
- world->set_savegame_filename(slotfile);
- world->run();
- }
- catch(std::exception& e)
+ if(!MenuManager::instance().is_active() && g_screen_manager->has_no_pending_fadeout())
{
- log_fatal << "Couldn't start world: " << e.what() << std::endl;
+ MenuManager::instance().set_menu(MenuStorage::MAIN_MENU);
}
}