1
// $Id: race_menu.cpp 3833 2009-08-11 12:07:12Z hikerstk $
3
// SuperTuxKart - a fun racing game with go-kart
4
// Copyright (C) 2006 SuperTuxKart-Team
6
// This program is free software; you can redistribute it and/or
7
// modify it under the terms of the GNU General Public License
8
// as published by the Free Software Foundation; either version 3
9
// of the License, or (at your option) any later version.
11
// This program is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
// GNU General Public License for more details.
16
// You should have received a copy of the GNU General Public License
17
// along with this program; if not, write to the Free Software
18
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
#include "gui/race_menu.hpp"
24
#include "user_config.hpp"
26
#include "race_manager.hpp"
27
#include "gui/menu_manager.hpp"
28
#include "gui/widget_manager.hpp"
29
#include "utils/translation.hpp"
44
widget_manager->switchOrder();
46
widget_manager->addTitleWgt( WTOK_PAUSE, 50, 7, _("Paused") );
48
widget_manager->addTextButtonWgt( WTOK_RETURN_RACE, 50, 7, _("Return To Race"));
49
widget_manager->addTextButtonWgt( WTOK_OPTIONS, 50, 7, _("Options") );
50
widget_manager->addTextButtonWgt( WTOK_HELP, 50, 7, _("Help") );
51
widget_manager->addTextButtonWgt( WTOK_RESTART_RACE, 50, 7, _("Restart Race") );
53
if(race_manager->getMinorMode()==RaceManager::MINOR_MODE_QUICK_RACE)
55
widget_manager->addTextButtonWgt( WTOK_SETUP_NEW_RACE, 50, 7,
56
_("Setup New Race") );
59
widget_manager->addTextButtonWgt( WTOK_QUIT, 50, 7, _("Exit Race") );
61
widget_manager->layout(WGT_AREA_ALL);
62
if(user_config->m_fullscreen) SDL_ShowCursor(SDL_ENABLE);
65
//-----------------------------------------------------------------------------
68
widget_manager->reset();
72
//-----------------------------------------------------------------------------
73
void RaceMenu::select()
75
int clicked_token = widget_manager->getSelectedWgt();
77
switch (clicked_token)
79
case WTOK_RETURN_RACE:
80
RaceManager::getWorld()->unpause();
81
menu_manager->popMenu();
82
if(user_config->m_fullscreen) SDL_ShowCursor(SDL_DISABLE);
85
case WTOK_SETUP_NEW_RACE:
86
RaceManager::getWorld()->unpause();
87
race_manager->exit_race();
88
menu_manager->pushMenu(MENUID_CHARSEL_P1);
91
case WTOK_RESTART_RACE:
92
menu_manager->popMenu();
93
if(user_config->m_fullscreen) SDL_ShowCursor(SDL_DISABLE);
94
race_manager->rerunRace();
98
menu_manager->pushMenu(MENUID_OPTIONS);
102
menu_manager->pushMenu(MENUID_HELP1);
106
RaceManager::getWorld()->unpause();
107
race_manager->exit_race();
115
//-----------------------------------------------------------------------------
116
void RaceMenu::handle(GameAction ga, int value)
124
RaceManager::getWorld()->unpause();
125
menu_manager->popMenu();
129
BaseGUI::handle(ga, value);