Back to index

supertuxkart  0.5+dfsg1
config_controls.cpp
Go to the documentation of this file.
00001 //  $Id: config_controls.cpp 2111 2008-05-31 07:04:30Z cosmosninja $
00002 //
00003 //  SuperTuxKart - a fun racing game with go-kart
00004 //  Copyright (C) 2006 SuperTuxKart-Team
00005 //
00006 //  This program is free software; you can redistribute it and/or
00007 //  modify it under the terms of the GNU General Public License
00008 //  as published by the Free Software Foundation; either version 2
00009 //  of the License, or (at your option) any later version.
00010 //
00011 //  This program is distributed in the hope that it will be useful,
00012 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //  GNU General Public License for more details.
00015 //
00016 //  You should have received a copy of the GNU General Public License
00017 //  along with this program; if not, write to the Free Software
00018 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019 
00020 #include "config_controls.hpp"
00021 #include "widget_manager.hpp"
00022 #include "menu_manager.hpp"
00023 #include "translation.hpp"
00024 #if defined(WIN32) && !defined(__CYGWIN__)
00025 #  define snprintf _snprintf
00026 #endif
00027 
00028 enum WidgetTokens
00029 {
00030     WTOK_TITLE,
00031 
00032     WTOK_PLYR1,
00033     WTOK_PLYR2,
00034     WTOK_PLYR3,
00035     WTOK_PLYR4,
00036 
00037     WTOK_QUIT
00038 };
00039 
00040 ConfigControls::ConfigControls()
00041 {
00042     widget_manager->switchOrder();
00043     widget_manager->addTitleWgt( WTOK_TITLE, 60, 7, _("Edit controls for who?"));
00044 
00045     widget_manager->addTextButtonWgt( WTOK_PLYR1 , 60, 7, _("Player 1"));
00046     widget_manager->addTextButtonWgt( WTOK_PLYR2 , 60, 7, _("Player 2"));
00047     widget_manager->addTextButtonWgt( WTOK_PLYR3 , 60, 7, _("Player 3"));
00048     widget_manager->addTextButtonWgt( WTOK_PLYR4 , 60, 7, _("Player 4"));
00049 
00050     widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 60, 5);
00051 
00052     widget_manager->addTextButtonWgt( WTOK_QUIT , 60, 7, _("Press <ESC> to go back"));
00053     widget_manager->setWgtTextSize( WTOK_QUIT, WGT_FNT_SML );
00054 
00055     widget_manager->layout( WGT_AREA_ALL );
00056 }
00057 
00058 //-----------------------------------------------------------------------------
00059 ConfigControls::~ConfigControls()
00060 {
00061     widget_manager->reset();
00062 }
00063 
00064 //-----------------------------------------------------------------------------
00065 void ConfigControls::select()
00066 {
00067     switch ( widget_manager->getSelectedWgt() )
00068     {
00069     case WTOK_PLYR1: menu_manager->pushMenu(MENUID_CONFIG_P1); break;
00070     case WTOK_PLYR2: menu_manager->pushMenu(MENUID_CONFIG_P2); break;
00071     case WTOK_PLYR3: menu_manager->pushMenu(MENUID_CONFIG_P3); break;
00072     case WTOK_PLYR4: menu_manager->pushMenu(MENUID_CONFIG_P4); break;
00073     case WTOK_QUIT: menu_manager->popMenu();                   break;
00074     }
00075 }
00076 
00077 
00078