// SuperTux
-// Copyright (C) 2008 Ingo Ruhnke <grumbel@gmx.de>
+// Copyright (C) 2008 Ingo Ruhnke <grumbel@gmail.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
+#include "supertux/menu/profile_menu.hpp"
+
#include <sstream>
-#include "gui/menu.hpp"
+#include "gui/menu_manager.hpp"
#include "gui/menu_item.hpp"
#include "supertux/gameconfig.hpp"
+#include "supertux/globals.hpp"
#include "util/gettext.hpp"
-enum ProfileMenuIDs {
-
-};
-
-class ProfileMenu : public Menu
+ProfileMenu::ProfileMenu()
{
-public:
- ProfileMenu() {
- add_label(_("Select Profile"));
- add_hl();
- for(int i = 0; i < 5; ++i)
+ add_label(_("Select Profile"));
+ add_hl();
+ for(int i = 1; i <= 5; ++i)
+ {
+ std::ostringstream out;
+ if (i == g_config->profile)
{
- std::ostringstream out;
- out << "Profile " << i+1;
- add_entry(i+1, out.str());
+ out << "[Profile " << i << "]";
}
-
- add_hl();
- add_back(_("Back"));
- }
-
- void menu_action(MenuItem* item) {
- g_config->profile = item->id;
- Menu::set_current(0);
+ else
+ {
+ out << "Profile " << i;
+ }
+ add_entry(i, out.str());
}
-};
-Menu* profile_menu = 0;
-
-Menu* get_profile_menu()
-{
- //static ProfileMenu menu;
- profile_menu = new ProfileMenu();
- return profile_menu;
+ add_hl();
+ add_back(_("Back"));
}
-void free_profile_menu()
+void
+ProfileMenu::menu_action(MenuItem* item)
{
- delete profile_menu;
- profile_menu = 0;
+ g_config->profile = item->id;
+ MenuManager::instance().clear_menu_stack();
}
/*