2 // Copyright (C) 2009 Ingo Ruhnke <grumbel@gmail.com>
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #include "supertux/menu/menu_storage.hpp"
19 #include "supertux/globals.hpp"
20 #include "supertux/menu/addon_menu.hpp"
21 #include "supertux/menu/cheat_menu.hpp"
22 #include "supertux/menu/contrib_menu.hpp"
23 #include "supertux/menu/game_menu.hpp"
24 #include "supertux/menu/joystick_menu.hpp"
25 #include "supertux/menu/keyboard_menu.hpp"
26 #include "supertux/menu/language_menu.hpp"
27 #include "supertux/menu/main_menu.hpp"
28 #include "supertux/menu/options_menu.hpp"
29 #include "supertux/menu/profile_menu.hpp"
30 #include "supertux/menu/worldmap_menu.hpp"
31 #include "supertux/menu/worldmap_cheat_menu.hpp"
33 MenuStorage* MenuStorage::s_instance = 0;
36 MenuStorage::instance()
42 MenuStorage::MenuStorage()
48 MenuStorage::~MenuStorage()
54 MenuStorage::create(MenuId menu_id)
59 return std::unique_ptr<Menu>(new MainMenu);
62 return std::unique_ptr<Menu>(new LanguageMenu);
65 return std::unique_ptr<Menu>(new OptionsMenu(true));
67 case INGAME_OPTIONS_MENU:
68 return std::unique_ptr<Menu>(new OptionsMenu(false));
71 return std::unique_ptr<Menu>(new ProfileMenu);
74 return std::unique_ptr<Menu>(new KeyboardMenu(*InputManager::current()));
77 return std::unique_ptr<Menu>(new JoystickMenu(*InputManager::current()));
80 return std::unique_ptr<Menu>(new WorldmapMenu);
82 case WORLDMAP_CHEAT_MENU:
83 return std::unique_ptr<Menu>(new WorldmapCheatMenu);
86 return std::unique_ptr<Menu>(new GameMenu);
89 return std::unique_ptr<Menu>(new CheatMenu);
92 return std::unique_ptr<Menu>(new ContribMenu);
94 case CONTRIB_WORLD_MENU:
95 return 0; //return new ContribWorldMenu();
98 return std::unique_ptr<Menu>(new AddonMenu);
101 return std::unique_ptr<Menu>();
104 assert(!"unknown MenuId provided");
105 return std::unique_ptr<Menu>();