src/supertux/menu/profile_menu.cpp

Go to the documentation of this file.
00001 //  SuperTux
00002 //  Copyright (C) 2008 Ingo Ruhnke <grumbel@gmx.de>
00003 //
00004 //  This program is free software: you can redistribute it and/or modify
00005 //  it under the terms of the GNU General Public License as published by
00006 //  the Free Software Foundation, either version 3 of the License, or
00007 //  (at your option) any later version.
00008 //
00009 //  This program is distributed in the hope that it will be useful,
00010 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 //  GNU General Public License for more details.
00013 //
00014 //  You should have received a copy of the GNU General Public License
00015 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016 
00017 #include "supertux/menu/profile_menu.hpp"
00018 
00019 #include <sstream>
00020 
00021 #include "gui/menu_manager.hpp"
00022 #include "gui/menu_item.hpp"
00023 #include "supertux/gameconfig.hpp"
00024 #include "supertux/globals.hpp"
00025 #include "util/gettext.hpp"
00026 
00027 ProfileMenu::ProfileMenu() 
00028 {
00029   add_label(_("Select Profile"));
00030   add_hl();
00031   for(int i = 0; i < 5; ++i)
00032   {
00033     std::ostringstream out;
00034     out << "Profile " << i+1;
00035     add_entry(i+1, out.str());
00036   }
00037 
00038   add_hl();
00039   add_back(_("Back"));
00040 }
00041 
00042 void
00043 ProfileMenu::menu_action(MenuItem* item) 
00044 {
00045   g_config->profile = item->id;
00046   MenuManager::set_current(0);
00047 }
00048 
00049 /*
00050   std::string
00051   TitleScreen::get_slotinfo(int slot)
00052   {
00053   std::string tmp;
00054   std::string title;
00055 
00056   std::string basename = current_world->get_basedir();
00057   basename = basename.substr(0, basename.length()-1);
00058   std::string worlddirname = FileSystem::basename(basename);
00059   std::ostringstream stream;
00060   stream << "profile" << config->profile << "/" << worlddirname << "_" << slot << ".stsg";
00061   std::string slotfile = stream.str();
00062 
00063   try {
00064   lisp::Parser parser;
00065   const lisp::Lisp* root = parser.parse(slotfile);
00066 
00067   const lisp::Lisp* savegame = root->get_lisp("supertux-savegame");
00068   if(!savegame)
00069   throw std::runtime_error("file is not a supertux-savegame.");
00070 
00071   savegame->get("title", title);
00072   } catch(std::exception& ) {
00073   std::ostringstream slottitle;
00074   slottitle << _("Slot") << " " << slot << " - " << _("Free");
00075   return slottitle.str();
00076   }
00077 
00078   std::ostringstream slottitle;
00079   slottitle << _("Slot") << " " << slot << " - " << title;
00080   return slottitle.str();
00081   }
00082 */
00083 
00084 /* EOF */

Generated on Mon Jun 9 03:38:22 2014 for SuperTux by  doxygen 1.5.1