Resized widgets to give some extra space; auto resize when layout() is called is now the default.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1842 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
cosmosninja 2008-05-10 10:01:16 +00:00
parent c184b9db34
commit 02f6cc26a4
8 changed files with 56 additions and 54 deletions

View File

@ -67,10 +67,10 @@ CharSel::CharSel(int whichPlayer)
char heading[MAX_MESSAGE_LENGTH];
snprintf(heading, sizeof(heading), _("Player %d, choose a driver"),
m_player_index + 1);
widget_manager->addTitleWgt( WTOK_TITLE, 60, 10, heading );
widget_manager->addTitleWgt( WTOK_TITLE, 100, 10, heading );
widget_manager->breakLine();
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 100, 2);
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 1, 2);
widget_manager->breakLine();
for (unsigned int i = 0; i < kart_properties_manager->getNumberOfKarts(); i++)
@ -87,7 +87,7 @@ CharSel::CharSel(int whichPlayer)
}
widget_manager->breakLine();
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 100, 2);
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 1, 2);
widget_manager->breakLine();
widget_manager->addTextWgt( WTOK_NAME, 30, 7, "");

View File

@ -52,11 +52,11 @@ ConfigDisplay::ConfigDisplay()
m_curr_height = m_sizes[m_curr_res].second;
widget_manager->insertColumn();
widget_manager->addTitleWgt( WTOK_TITLE, 40, 7, _("Display Settings"));
widget_manager->addTitleWgt( WTOK_TITLE, 60, 7, _("Display Settings"));
if( isBlacklisted( m_curr_width, m_curr_height ))
{
widget_manager->addEmptyWgt( WTOK_FULLSCREEN, 40, 7);
widget_manager->addEmptyWgt( WTOK_FULLSCREEN, 1, 7);
if (user_config->m_fullscreen)
{
@ -67,38 +67,38 @@ ConfigDisplay::ConfigDisplay()
{
if(user_config->m_fullscreen)
{
widget_manager->addTextButtonWgt( WTOK_FULLSCREEN, 40, 7,
widget_manager->addTextButtonWgt( WTOK_FULLSCREEN, 60, 7,
_("Window mode"));
}
else
{
widget_manager->addTextButtonWgt( WTOK_FULLSCREEN, 40, 7,
widget_manager->addTextButtonWgt( WTOK_FULLSCREEN, 60, 7,
_("Fullscreen mode"));
}
}
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 40, 2 );
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 60, 2 );
char msg [MAX_MESSAGE_LENGTH];
snprintf( msg, MAX_MESSAGE_LENGTH, _("Current: %dx%d"), m_curr_width, m_curr_height );
widget_manager->addTextWgt( WTOK_CURRENT_RES, 40, 7, msg);
widget_manager->addTextWgt( WTOK_CURRENT_RES, 60, 7, msg);
widget_manager->addTextButtonWgt( WTOK_INCR_RES, 40, 7,
widget_manager->addTextButtonWgt( WTOK_INCR_RES, 60, 7,
_("Increase Resolution"));
widget_manager->addTextButtonWgt( WTOK_DECR_RES, 40, 7,
widget_manager->addTextButtonWgt( WTOK_DECR_RES, 60, 7,
_("Decrease Resolution"));
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 40, 2 );
widget_manager->addTextButtonWgt( WTOK_APPLY_RES, 40, 7, _("Apply "));
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 40, 2 );
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 1, 2 );
widget_manager->addTextButtonWgt( WTOK_APPLY_RES, 60, 7, _("Apply "));
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 1, 2 );
widget_manager->addEmptyWgt( WTOK_CLEAR_BLACKLIST, 40, 7);
widget_manager->addEmptyWgt( WTOK_CLEAR_BLACKLIST, 60, 7);
widget_manager->setWgtText( WTOK_CLEAR_BLACKLIST,
_("Clear from Blacklist") );
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 40, 2 );
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 1, 2 );
widget_manager->addTextButtonWgt( WTOK_QUIT, 40, 7, _("Press <ESC> to go back"));
widget_manager->addTextButtonWgt( WTOK_QUIT, 60, 7, _("Press <ESC> to go back"));
widget_manager->setWgtTextSize( WTOK_QUIT, WGT_FNT_SML );
widget_manager->layout( WGT_AREA_ALL );

View File

@ -37,30 +37,30 @@ enum WidgetTokens
ConfigSound::ConfigSound()
{
widget_manager->insertColumn();
widget_manager->addTitleWgt(WTOK_TITLE, 40, 7, _("Sound Settings"));
widget_manager->addTitleWgt(WTOK_TITLE, 50, 7, _("Sound Settings"));
widget_manager->setInitialActivationState(true);
if( user_config->doMusic() )
{
widget_manager->addTextButtonWgt( WTOK_MUSIC, 40, 7, _("Turn off music"));
widget_manager->addTextButtonWgt( WTOK_MUSIC, 50, 7, _("Turn off music"));
}
else
{
widget_manager->addTextButtonWgt( WTOK_MUSIC, 40, 7, _("Turn on music"));
widget_manager->addTextButtonWgt( WTOK_MUSIC, 50, 7, _("Turn on music"));
}
if( user_config->doSFX() )
{
widget_manager->addTextButtonWgt( WTOK_SFX, 40, 7, _("Turn off sound effects"));
widget_manager->addTextButtonWgt( WTOK_SFX, 50, 7, _("Turn off sound effects"));
}
else
{
widget_manager->addTextButtonWgt( WTOK_SFX, 40, 7, _("Turn on sound effects"));
widget_manager->addTextButtonWgt( WTOK_SFX, 50, 7, _("Turn on sound effects"));
}
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 40, 5);
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 1, 5);
widget_manager->addTextButtonWgt(WTOK_QUIT, 40, 7,_("Press <ESC> to go back"));
widget_manager->addTextButtonWgt(WTOK_QUIT, 50, 7,_("Press <ESC> to go back"));
widget_manager->setWgtTextSize(WTOK_QUIT, WGT_FNT_SML);
widget_manager->layout(WGT_AREA_ALL);

View File

@ -63,7 +63,7 @@ CreditsMenu::CreditsMenu()
}
widget_manager->addTextWgt( WTOK_CREDITS, 100, 93, credits_text );
widget_manager->addTextWgt( WTOK_CREDITS, 100, 93, "" );
widget_manager->setWgtTextSize( WTOK_CREDITS, WGT_FNT_SML );
//FIXME: maybe I should make scroll names more consistent
widget_manager->activateWgt( WTOK_CREDITS );
@ -76,6 +76,9 @@ CreditsMenu::CreditsMenu()
_("Go back to the main menu"));
widget_manager->layout( WGT_AREA_TOP );
//This is done after layout so the widget doesn't gets resized.
widget_manager->setWgtText( WTOK_CREDITS, credits_text );
} // CreditsMenu
//-----------------------------------------------------------------------------

View File

@ -41,41 +41,41 @@ enum WidgetTokens
GameMode::GameMode()
{
widget_manager->insertColumn();
widget_manager->addTitleWgt(WTOK_TITLE, 50, 7, _("Choose a Race Mode"));
widget_manager->addTitleWgt(WTOK_TITLE, 60, 7, _("Choose a Race Mode"));
if(unlock_manager->isLocked("grandprix"))
{
const Material *m = material_manager->getMaterial("gui_lock.rgb", false);
widget_manager->addImgWgt(WTOK_GP, 50, 7,
widget_manager->addImgWgt(WTOK_GP, 60, 7,
m->getState()->getTextureHandle() );
}
else
{
widget_manager->addTextButtonWgt( WTOK_GP, 50, 7, _("Grand Prix"));
widget_manager->addTextButtonWgt( WTOK_GP, 60, 7, _("Grand Prix"));
}
widget_manager->addTextButtonWgt(WTOK_QUICKRACE, 50, 7, _("Quick Race"));
widget_manager->addTextButtonWgt(WTOK_QUICKRACE, 60, 7, _("Quick Race"));
if( race_manager->getNumPlayers() == 1 )
{
widget_manager->addTextButtonWgt(WTOK_TIMETRIAL, 50, 7, _("Time Trial"));
widget_manager->addTextButtonWgt(WTOK_TIMETRIAL, 60, 7, _("Time Trial"));
}
if(unlock_manager->isLocked("followleader"))
{
const Material *m = material_manager->getMaterial("gui_lock.rgb", false);
widget_manager->addImgWgt(WTOK_GP, 50, 7,
widget_manager->addImgWgt(WTOK_GP, 60, 7,
m->getState()->getTextureHandle() );
widget_manager->showWgtTexture( WTOK_FOLLOW_LEADER );
}
else
{
widget_manager->addTextButtonWgt( WTOK_FOLLOW_LEADER, 50, 7,
widget_manager->addTextButtonWgt( WTOK_FOLLOW_LEADER, 60, 7,
_("Follow the Leader"));
}
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 50, 7);
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 1, 7);
widget_manager->addTextButtonWgt(WTOK_QUIT, 50, 7, _("Press <ESC> to go back"));
widget_manager->addTextButtonWgt(WTOK_QUIT, 60, 7, _("Press <ESC> to go back"));
widget_manager->setWgtTextSize( WTOK_QUIT, WGT_FNT_SML );
widget_manager->layout(WGT_AREA_ALL);

View File

@ -37,8 +37,8 @@ enum WidgetTokens
Options::Options()
{
widget_manager->insertColumn();
widget_manager->addTitleWgt( WTOK_TITLE, 35, 7, _("Options") );
widget_manager->addTextButtonWgt( WTOK_CONTROLS, 35, 7, _("Player Config") );
widget_manager->addTitleWgt( WTOK_TITLE, 45, 7, _("Options") );
widget_manager->addTextButtonWgt( WTOK_CONTROLS, 45, 7, _("Player Config") );
// Don't display the fullscreen menu when called from within the race.
// The fullscreen mode will reload all textures, reload the models,
@ -46,14 +46,14 @@ Options::Options()
// to windows, who discards all textures, ...)
if(!menu_manager->isSomewhereOnStack( MENUID_RACE ))
{
widget_manager->addTextButtonWgt( WTOK_DISPLAY, 35, 7, _("Display") );
widget_manager->addTextButtonWgt( WTOK_DISPLAY, 45, 7, _("Display") );
}
widget_manager->addTextButtonWgt( WTOK_SOUND, 35, 7, _("Sound") );
widget_manager->addTextButtonWgt( WTOK_SOUND, 45, 7, _("Sound") );
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 35, 7 );
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 1, 7 );
widget_manager->addTextButtonWgt( WTOK_QUIT, 35, 7,
widget_manager->addTextButtonWgt( WTOK_QUIT, 45, 7,
_("Press <ESC> to go back") );
widget_manager->setWgtTextSize( WTOK_QUIT, WGT_FNT_SML );

View File

@ -63,15 +63,15 @@ RaceOptions::RaceOptions() :
if( race_manager->getRaceMode() != RaceManager::RM_TIME_TRIAL )
{
widget_manager->insertColumn();
widget_manager->addTextWgt( WTOK_DIFFICULTY_TITLE, 30, 7, _("Difficulty") );
widget_manager->addTextButtonWgt( WTOK_DIFFICULTY_UP, 12, 12, _("More") );
widget_manager->addTextWgt( WTOK_DIFFICULTY_TITLE, 32, 7, _("Difficulty") );
widget_manager->addTextButtonWgt( WTOK_DIFFICULTY_UP, 20, 12, _("More") );
widget_manager->addTextWgt( WTOK_DIFFICULTY, 12, 7, _("Racer") );
widget_manager->addTextWgt( WTOK_DIFFICULTY, 32, 7, _("Racer") );
widget_manager->setWgtBorderPercentage( WTOK_DIFFICULTY, 10 );
widget_manager->showWgtBorder( WTOK_DIFFICULTY );
widget_manager->hideWgtRect( WTOK_DIFFICULTY );
widget_manager->addTextButtonWgt( WTOK_DIFFICULTY_DOWN, 12, 12, _("Less") );
widget_manager->addTextButtonWgt( WTOK_DIFFICULTY_DOWN, 20, 12, _("Less") );
widget_manager->breakLine();
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 1, 1);
@ -80,15 +80,15 @@ RaceOptions::RaceOptions() :
if( race_manager->getRaceMode() != RaceManager::RM_TIME_TRIAL )
{
widget_manager->insertColumn();
widget_manager->addTextWgt( WTOK_KARTS_TITLE, 30, 7, _("Number of karts") );
widget_manager->addTextButtonWgt( WTOK_KARTS_UP, 12, 12, _("More") );
widget_manager->addTextWgt( WTOK_KARTS_TITLE, 32, 7, _("Number of karts") );
widget_manager->addTextButtonWgt( WTOK_KARTS_UP, 20, 12, _("More") );
widget_manager->addTextWgt( WTOK_KARTS, 12, 7, "4" );
widget_manager->addTextWgt( WTOK_KARTS, 32, 7, "4" );
widget_manager->setWgtBorderPercentage( WTOK_KARTS, 10 );
widget_manager->showWgtBorder( WTOK_KARTS );
widget_manager->hideWgtRect( WTOK_KARTS );
widget_manager->addTextButtonWgt( WTOK_KARTS_DOWN, 12, 12, _("Less") );
widget_manager->addTextButtonWgt( WTOK_KARTS_DOWN, 20, 12, _("Less") );
widget_manager->breakLine();
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 1, 1);
@ -98,15 +98,15 @@ RaceOptions::RaceOptions() :
race_manager->getRaceMode() != RaceManager::RM_FOLLOW_LEADER )
{
widget_manager->insertColumn();
widget_manager->addTextWgt( WTOK_LAPS_TITLE, 30, 7, _("Number of laps") );
widget_manager->addTextButtonWgt( WTOK_LAPS_UP, 12, 12, _("More") );
widget_manager->addTextWgt( WTOK_LAPS_TITLE, 32, 7, _("Number of laps") );
widget_manager->addTextButtonWgt( WTOK_LAPS_UP, 20, 12, _("More") );
widget_manager->addTextWgt( WTOK_LAPS, 12, 7, "3" );
widget_manager->addTextWgt( WTOK_LAPS, 32, 7, "3" );
widget_manager->setWgtBorderPercentage( WTOK_LAPS, 10 );
widget_manager->showWgtBorder( WTOK_LAPS );
widget_manager->hideWgtRect( WTOK_LAPS );
widget_manager->addTextButtonWgt( WTOK_LAPS_DOWN, 12, 12, _("Less") );
widget_manager->addTextButtonWgt( WTOK_LAPS_DOWN, 20, 12, _("Less") );
widget_manager->breakLine();
}
@ -150,7 +150,6 @@ void RaceOptions::select()
m_difficulty = RaceManager::RD_MEDIUM;
widget_manager->setWgtText( WTOK_DIFFICULTY, _("Driver") );
}
widget_manager->resizeWgtToText( WTOK_DIFFICULTY );
break;
case WTOK_DIFFICULTY_DOWN:

View File

@ -1012,7 +1012,7 @@ void WidgetManager::restoreDefaultStates()
m_default_text_size = WGT_FNT_MED;
m_default_font = WGT_FONT_GUI;
m_default_text_color = WGT_WHITE;
m_default_resize_to_text = false;
m_default_resize_to_text = true;
m_default_enable_scroll = false;
m_default_scroll_preset_x = WGT_SCROLL_CENTER;
m_default_scroll_preset_y = WGT_SCROLL_CENTER;