Back to index

supertuxkart  0.5+dfsg1
num_players.cpp
Go to the documentation of this file.
00001 //  $Id: num_players.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 "race_manager.hpp"
00021 #include "num_players.hpp"
00022 #include "widget_manager.hpp"
00023 #include "menu_manager.hpp"
00024 #include "translation.hpp"
00025 
00026 enum WidgetTokens
00027 {
00028     WTOK_PLAYER_2 = 2,
00029     WTOK_PLAYER_3,
00030     WTOK_PLAYER_4,
00031 
00032     WTOK_QUIT
00033 };
00034 
00035 NumPlayers::NumPlayers()
00036 {
00037     widget_manager->switchOrder();
00038     widget_manager->addTextButtonWgt( WTOK_PLAYER_2, 35, 7, _("Two Players") );
00039     widget_manager->addTextButtonWgt( WTOK_PLAYER_3, 35, 7, _("Three Players") );
00040     widget_manager->addTextButtonWgt( WTOK_PLAYER_4, 35, 7, _("Four Players") );
00041 
00042     widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 35, 7 );
00043 
00044     widget_manager->addTextButtonWgt( WTOK_QUIT, 35, 7,
00045         _("Press <ESC> to go back") );
00046     widget_manager->setWgtTextSize( WTOK_QUIT, WGT_FNT_SML );
00047 
00048     widget_manager->layout(WGT_AREA_ALL);
00049 }
00050 
00051 // -----------------------------------------------------------------------------
00052 NumPlayers::~NumPlayers()
00053 {
00054     widget_manager->reset() ;
00055 }
00056 
00057 // -----------------------------------------------------------------------------
00058 void NumPlayers::select()
00059 {
00060     switch ( widget_manager->getSelectedWgt() )
00061     {
00062     case WTOK_PLAYER_2:
00063     case WTOK_PLAYER_3:
00064     case WTOK_PLAYER_4:
00065         race_manager->setNumPlayers(widget_manager->getSelectedWgt());
00066         menu_manager->pushMenu(MENUID_GAMEMODE);
00067         break;
00068     case WTOK_QUIT:
00069         menu_manager->popMenu();
00070         break;
00071     default:
00072         break;
00073     }
00074 }
00075 
00076 
00077