Reassign rounded borders to menus that were missing it.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1809 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
cosmosninja 2008-05-04 00:09:16 +00:00
parent bbb970301c
commit c22e86aa68
7 changed files with 98 additions and 97 deletions

View File

@ -64,18 +64,13 @@ CharSel::CharSel(int whichPlayer)
if (m_player_index < (int)kart_properties_manager->m_selected_karts.size())
kart_properties_manager->m_selected_karts.pop_back();
widget_manager->setInitialActivationState(false);
widget_manager->addWgt( WTOK_TITLE, 60, 10);
widget_manager->showWgtRect( WTOK_TITLE );
char heading[MAX_MESSAGE_LENGTH];
snprintf(heading, sizeof(heading), _("Player %d, choose a driver"),
m_player_index + 1);
widget_manager->setWgtText( WTOK_TITLE, heading);
widget_manager->setWgtTextSize( WTOK_TITLE, WGT_FNT_LRG);
widget_manager->showWgtText( WTOK_TITLE );
widget_manager->addTitleWgt( WTOK_TITLE, 60, 10, heading );
widget_manager->breakLine();
widget_manager->addWgt( WidgetManager::WGT_NONE, 100, 2);
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 100, 2);
widget_manager->breakLine();
for (unsigned int i = 0; i < kart_properties_manager->getNumberOfKarts(); i++)
@ -85,28 +80,20 @@ CharSel::CharSel(int whichPlayer)
{
const KartProperties* kp= kart_properties_manager->getKartById(i);
if(unlock_manager->isLocked(kp->getIdent())) continue;
widget_manager->addWgt( WTOK_RACER0 + i, 8, 11);
widget_manager->showWgtRect( WTOK_RACER0 + i);
widget_manager->setWgtColor( WTOK_RACER0 + i, WGT_GRAY);
widget_manager->setWgtTexture( WTOK_RACER0 + i, kp->getIconFile() );
widget_manager->showWgtTexture( WTOK_RACER0 + i );
widget_manager->activateWgt( WTOK_RACER0 + i );
widget_manager->addImgButtonWgt( WTOK_RACER0 + i, 8, 11,
kp->getIconFile() );
}
}
widget_manager->breakLine();
widget_manager->addWgt( WidgetManager::WGT_NONE, 100, 2);
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 100, 2);
widget_manager->breakLine();
//FIXME: the widget should check if the dimensions > 100
widget_manager->addWgt( WTOK_NAME, 30, 7);
widget_manager->showWgtRect( WTOK_NAME );
widget_manager->showWgtText( WTOK_NAME );
widget_manager->addTextWgt( WTOK_NAME, 30, 7, "");
//FIXME: widget_manager says that token -1 is already in use
widget_manager->layout(WGT_AREA_TOP);
m_current_kart = -1;
const int LAST_KART = user_config->m_player[m_player_index].getLastKartId();
@ -207,7 +194,7 @@ void CharSel::select()
{
race_manager->setPlayerKart(m_player_index, KP->getIdent());
user_config->m_player[m_player_index].setLastKartId(TOKEN);
// Add selected kart (TOKEN) to selected karts vector so it cannot be
// Add selected kart (TOKEN) to selected karts vector so it cannot be
// selected again
kart_properties_manager->m_selected_karts.push_back(TOKEN);
}

View File

@ -40,7 +40,7 @@ enum WidgetTokens
ConfigControls::ConfigControls()
{
widget_manager->insertColumn();
widget_manager->addTitleWgt( WTOK_TITLE, 60, 7, _("Edit controls for which player?"));
widget_manager->addTitleWgt( WTOK_TITLE, 60, 7, _("Edit controls for who?"));
widget_manager->addTextButtonWgt( WTOK_PLYR1 , 60, 7, _("Player 1"));
widget_manager->addTextButtonWgt( WTOK_PLYR2 , 60, 7, _("Player 2"));

View File

@ -28,44 +28,22 @@ enum WidgetTokens
WTOK_PLAYER_2 = 2,
WTOK_PLAYER_3,
WTOK_PLAYER_4,
WTOK_BACK
WTOK_QUIT
};
NumPlayers::NumPlayers()
{
widget_manager->addWgt(WTOK_PLAYER_2, 35, 7);
widget_manager->showWgtRect( WTOK_PLAYER_2 );
widget_manager->setWgtText( WTOK_PLAYER_2, _("Two Players") );
widget_manager->setWgtTextSize( WTOK_PLAYER_2, WGT_FNT_MED );
widget_manager->showWgtText( WTOK_PLAYER_2 );
widget_manager->activateWgt( WTOK_PLAYER_2 );
widget_manager->breakLine();
widget_manager->insertColumn();
widget_manager->addTextButtonWgt( WTOK_PLAYER_2, 35, 7, _("Two Players") );
widget_manager->addTextButtonWgt( WTOK_PLAYER_3, 35, 7, _("Three Players") );
widget_manager->addTextButtonWgt( WTOK_PLAYER_4, 35, 7, _("Four Players") );
widget_manager->addWgt(WTOK_PLAYER_3, 35, 7);
widget_manager->showWgtRect( WTOK_PLAYER_3 );
widget_manager->setWgtText( WTOK_PLAYER_3, _("Three Players") );
widget_manager->setWgtTextSize( WTOK_PLAYER_3, WGT_FNT_MED );
widget_manager->showWgtText( WTOK_PLAYER_3 );
widget_manager->activateWgt( WTOK_PLAYER_3);
widget_manager->breakLine();
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 35, 7 );
widget_manager->addWgt(WTOK_PLAYER_4, 35, 7);
widget_manager->showWgtRect( WTOK_PLAYER_4 );
widget_manager->setWgtText( WTOK_PLAYER_4, _("Four Players") );
widget_manager->setWgtTextSize( WTOK_PLAYER_4, WGT_FNT_MED );
widget_manager->showWgtText( WTOK_PLAYER_4 );
widget_manager->activateWgt( WTOK_PLAYER_4 );
widget_manager->breakLine();
widget_manager->addWgt(WidgetManager::WGT_NONE, 35, 7);
widget_manager->breakLine();
widget_manager->addWgt(WTOK_BACK, 35, 7);
widget_manager->showWgtRect( WTOK_BACK );
widget_manager->setWgtText( WTOK_BACK, _("Press <ESC> to go back") );
widget_manager->setWgtTextSize( WTOK_BACK, WGT_FNT_SML );
widget_manager->showWgtText( WTOK_BACK );
widget_manager->activateWgt( WTOK_BACK );
widget_manager->addTextButtonWgt( WTOK_QUIT, 35, 7,
_("Press <ESC> to go back") );
widget_manager->setWgtTextSize( WTOK_QUIT, WGT_FNT_SML );
widget_manager->layout(WGT_AREA_ALL);
}
@ -87,7 +65,7 @@ void NumPlayers::select()
race_manager->setNumPlayers(widget_manager->getSelectedWgt());
menu_manager->pushMenu(MENUID_GAMEMODE);
break;
case WTOK_BACK:
case WTOK_QUIT:
menu_manager->popMenu();
break;
default:

View File

@ -26,61 +26,36 @@
enum WidgetTokens
{
WTOK_TITLE,
WTOK_CONTROLS,
WTOK_DISPLAY,
WTOK_SOUND,
WTOK_BACK
WTOK_QUIT
};
Options::Options()
{
widget_manager->addWgt(WTOK_TITLE, 35, 7);
widget_manager->showWgtRect( WTOK_TITLE );
widget_manager->setWgtText( WTOK_TITLE, _("Options") );
widget_manager->setWgtTextSize( WTOK_TITLE, WGT_FNT_LRG );
widget_manager->showWgtText( WTOK_TITLE );
widget_manager->breakLine();
widget_manager->addWgt(WTOK_CONTROLS, 35, 7);
widget_manager->showWgtRect( WTOK_CONTROLS );
widget_manager->setWgtText( WTOK_CONTROLS, _("Player Config") );
widget_manager->setWgtTextSize( WTOK_CONTROLS, WGT_FNT_MED );
widget_manager->showWgtText( WTOK_CONTROLS );
widget_manager->activateWgt( WTOK_CONTROLS);
widget_manager->breakLine();
widget_manager->insertColumn();
widget_manager->addTitleWgt( WTOK_TITLE, 35, 7, _("Options") );
widget_manager->addTextButtonWgt( WTOK_CONTROLS, 35, 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,
// ... basically creating a big mess!! (and all of this only thanks
// to windows, who discards all textures, ...)
if(!menu_manager->isSomewhereOnStack(MENUID_RACE))
if(!menu_manager->isSomewhereOnStack( MENUID_RACE ))
{
widget_manager->addWgt(WTOK_DISPLAY, 35, 7);
widget_manager->showWgtRect( WTOK_DISPLAY );
widget_manager->setWgtText( WTOK_DISPLAY, _("Display") );
widget_manager->setWgtTextSize( WTOK_DISPLAY, WGT_FNT_MED );
widget_manager->showWgtText( WTOK_DISPLAY );
widget_manager->activateWgt( WTOK_DISPLAY );
widget_manager->breakLine();
widget_manager->addTextButtonWgt( WTOK_DISPLAY, 35, 7, _("Display") );
}
widget_manager->addWgt(WTOK_SOUND, 35, 7);
widget_manager->showWgtRect( WTOK_SOUND );
widget_manager->setWgtText( WTOK_SOUND, _("Sound") );
widget_manager->setWgtTextSize( WTOK_SOUND, WGT_FNT_MED );
widget_manager->showWgtText( WTOK_SOUND );
widget_manager->activateWgt( WTOK_SOUND );
widget_manager->breakLine();
widget_manager->addTextButtonWgt( WTOK_SOUND, 35, 7, _("Sound") );
widget_manager->addWgt(WidgetManager::WGT_NONE, 35, 7);
widget_manager->breakLine();
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 35, 7 );
widget_manager->addWgt(WTOK_BACK, 35, 7);
widget_manager->showWgtRect( WTOK_BACK );
widget_manager->setWgtText( WTOK_BACK, _("Press <ESC> to go back") );
widget_manager->setWgtTextSize( WTOK_BACK, WGT_FNT_SML );
widget_manager->showWgtText( WTOK_BACK );
widget_manager->activateWgt( WTOK_BACK );
widget_manager->addTextButtonWgt( WTOK_QUIT, 35, 7,
_("Press <ESC> to go back") );
widget_manager->setWgtTextSize( WTOK_QUIT, WGT_FNT_SML );
widget_manager->layout(WGT_AREA_ALL);
}
@ -95,7 +70,6 @@ Options::~Options()
void Options::select()
{
switch ( widget_manager->getSelectedWgt() )
// switch ( widgetSet -> get_token (widgetSet -> click()) )
{
case WTOK_CONTROLS:
menu_manager->pushMenu(MENUID_CONFIG_CONTROLS);
@ -106,10 +80,11 @@ void Options::select()
case WTOK_SOUND:
menu_manager->pushMenu(MENUID_CONFIG_SOUND);
break;
case WTOK_BACK:
case WTOK_QUIT:
//FIXME: this shouldn't be in this screen
// Make config changes permanent.
user_config->saveConfig();
menu_manager->popMenu();
break;
default:

View File

@ -104,7 +104,7 @@ PlayerControls::PlayerControls(int whichPlayer):
widget_manager->breakLine();
widget_manager->breakLine();
widget_manager->addTextWgt( WTOK_QUIT, 60, 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

@ -822,6 +822,28 @@ bool WidgetManager::addImgWgt
return true;
}
//-----------------------------------------------------------------------------
bool WidgetManager::addImgWgt
(
const int TOKEN,
const int MIN_WIDTH,
const int MIN_HEIGHT,
const char* FILENAME
)
{
if( !( addWgt( TOKEN, MIN_WIDTH, MIN_HEIGHT ))) return false;
setWgtColor( TOKEN, WGT_WHITE );
showWgtRect( TOKEN );
setWgtBorderPercentage( TOKEN, 5 );
setWgtBorderColor( TOKEN, WGT_BLACK );
showWgtBorder( TOKEN );
setWgtTexture( TOKEN, FILENAME );
showWgtTexture( TOKEN );
return true;
}
//-----------------------------------------------------------------------------
bool WidgetManager::addImgButtonWgt
(
@ -844,6 +866,28 @@ bool WidgetManager::addImgButtonWgt
return true;
}
//-----------------------------------------------------------------------------
bool WidgetManager::addImgButtonWgt
(
const int TOKEN,
const int MIN_WIDTH,
const int MIN_HEIGHT,
const char* FILENAME
)
{
if( !( addWgt( TOKEN, MIN_WIDTH, MIN_HEIGHT ))) return false;
setWgtColor( TOKEN, WGT_GRAY );
showWgtRect( TOKEN );
setWgtRoundCorners( TOKEN, WGT_AREA_ALL );
setWgtCornerRadius( TOKEN, 20 );
setWgtTexture( TOKEN, FILENAME );
showWgtTexture( TOKEN );
activateWgt( TOKEN );
return true;
}
//-----------------------------------------------------------------------------
void WidgetManager::setInitialActivationState( const bool ACTIVE)
{

View File

@ -240,6 +240,15 @@ public:
const int IMG
);
bool addImgWgt
(
const int TOKEN,
const int MIN_WIDTH,
const int MIN_HEIGHT,
const char* FILENAME
);
//Selectable widget with visible rect & image, rounded corners with 20% radius,
//gray rect and texture
bool addImgButtonWgt
@ -250,6 +259,14 @@ public:
const int IMG
);
bool addImgButtonWgt
(
const int TOKEN,
const int MIN_WIDTH,
const int MIN_HEIGHT,
const char* FILENAME
);
/* On/off widget switch features. They are all disabled/hidden initially. */
void setInitialActivationState( const bool ACTIVE);