Changes to lower the number of lines of code.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1320 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
cosmosninja 2007-12-06 04:04:08 +00:00
parent e6a0fe8b72
commit 5c2b24727c

View File

@ -28,69 +28,45 @@ enum WidgetTokens {
WTOK_GP,
WTOK_QUICKRACE,
WTOK_TIMETRIAL,
WTOK_EMPTY,
WTOK_BACK
};
GameMode::GameMode()
{
widget_manager->insert_column();
const bool SHOW_RECT = true;
const bool SHOW_TEXT = true;
widget_manager->set_initial_rect_state(SHOW_RECT, WGT_AREA_ALL, WGT_TRANS_BLACK);
widget_manager->set_initial_text_state(SHOW_TEXT, "", WGT_FNT_MED, Font::ALIGN_CENTER, Font::ALIGN_CENTER );
widget_manager->insert_column();
widget_manager->add_wgt(WTOK_TITLE, 50, 7);
widget_manager->show_wgt_rect( WTOK_TITLE );
widget_manager->set_wgt_text( WTOK_TITLE, _("Choose a Race Mode"));
widget_manager->set_wgt_text_size( WTOK_TITLE, WGT_FNT_LRG );
widget_manager->show_wgt_text( WTOK_TITLE );
widget_manager->set_initial_activation_state(true);
widget_manager->add_wgt(WTOK_GP, 50, 7);
widget_manager->show_wgt_rect( WTOK_GP );
widget_manager->set_wgt_text( WTOK_GP, _("Grand Prix"));
widget_manager->set_wgt_text_size( WTOK_GP, WGT_FNT_MED );
widget_manager->show_wgt_text( WTOK_GP );
widget_manager->activate_wgt( WTOK_GP );
widget_manager->add_wgt(WTOK_QUICKRACE, 50, 7);
widget_manager->show_wgt_rect( WTOK_QUICKRACE );
widget_manager->set_wgt_text( WTOK_QUICKRACE, _("Quick Race"));
widget_manager->set_wgt_text_size( WTOK_QUICKRACE, WGT_FNT_MED );
widget_manager->show_wgt_text( WTOK_QUICKRACE );
widget_manager->activate_wgt( WTOK_QUICKRACE );
if( race_manager->getNumPlayers() == 1 )
{
widget_manager->add_wgt(WTOK_TIMETRIAL, 50, 7);
widget_manager->show_wgt_rect( WTOK_TIMETRIAL );
widget_manager->set_wgt_text( WTOK_TIMETRIAL, _("Time Trial"));
widget_manager->set_wgt_text_size( WTOK_TIMETRIAL, WGT_FNT_MED );
widget_manager->show_wgt_text( WTOK_TIMETRIAL );
widget_manager->activate_wgt( WTOK_TIMETRIAL );
}
widget_manager->add_wgt(WidgetManager::WGT_NONE, 50, 7);
widget_manager->add_wgt(WTOK_EMPTY, 50, 7);
widget_manager->hide_wgt_rect( WTOK_EMPTY );
widget_manager->hide_wgt_text( WTOK_EMPTY );
widget_manager->deactivate_wgt( WTOK_EMPTY );
widget_manager->add_wgt(WTOK_BACK, 50, 7);
widget_manager->show_wgt_rect( WTOK_BACK );
widget_manager->set_wgt_text( WTOK_BACK, _("Press <ESC> to go back"));
widget_manager->set_wgt_text_size( WTOK_BACK, WGT_FNT_SML );
widget_manager->show_wgt_text( WTOK_BACK );
widget_manager->activate_wgt( WTOK_BACK );
widget_manager->layout(WGT_AREA_ALL);
/* m_menu_id = widgetSet -> vstack(0);
widgetSet -> label(m_menu_id, _("Choose a Race Mode"), GUI_LRG);
const int VA = widgetSet -> varray(m_menu_id);
widgetSet -> space(m_menu_id);
widgetSet -> start(VA, _("Grand Prix"), GUI_MED, WTOK_GP);
widgetSet -> state(VA, _("Quick Race"), GUI_MED, WTOK_QUICKRACE);
if (race_manager->getNumPlayers() == 1)
widgetSet -> state(VA, _("Time Trial"), GUI_MED, WTOK_TIMETRIAL);
widgetSet -> space(VA);
widgetSet -> state(VA,_("Press <ESC> to go back"), GUI_SML, WTOK_BACK);
widgetSet -> space(VA);
widgetSet -> layout(m_menu_id, 0, 0);*/
}
//-----------------------------------------------------------------------------
@ -102,7 +78,6 @@ GameMode::~GameMode()
//-----------------------------------------------------------------------------
void GameMode::select()
{
// switch ( widgetSet -> get_token (widgetSet -> click()) )
switch ( widget_manager->get_selected_wgt() )
{
case WTOK_GP: