Added utility methods to set badges in GUI; used them to fix missing green badge when selecting kart
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4861 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
620f63adc2
commit
c151c124cb
@ -218,6 +218,15 @@ namespace GUIEngine
|
|||||||
/** A bitmask of which badges to show, if any; choices are *_BADGE, defined above */
|
/** A bitmask of which badges to show, if any; choices are *_BADGE, defined above */
|
||||||
int m_badges;
|
int m_badges;
|
||||||
|
|
||||||
|
void setBadge(int badge_bit)
|
||||||
|
{
|
||||||
|
m_badges |= badge_bit;
|
||||||
|
}
|
||||||
|
void unsetBadge(int badge_bit)
|
||||||
|
{
|
||||||
|
m_badges &= (~badge_bit);
|
||||||
|
}
|
||||||
|
|
||||||
/** Set to false if widget is something that should not receieve focus */
|
/** Set to false if widget is something that should not receieve focus */
|
||||||
bool m_focusable;
|
bool m_focusable;
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ GPInfoDialog::GPInfoDialog(const std::string& gpIdent, const float w, const floa
|
|||||||
{
|
{
|
||||||
okBtn->m_properties[PROP_ID] = "cannot_start";
|
okBtn->m_properties[PROP_ID] = "cannot_start";
|
||||||
okBtn->m_text = _("This Grand Prix is broken!");
|
okBtn->m_text = _("This Grand Prix is broken!");
|
||||||
okBtn->m_badges |= BAD_BADGE;
|
okBtn->setBadge(BAD_BADGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
okBtn->x = m_area.getWidth()/2 - 200;
|
okBtn->x = m_area.getWidth()/2 - 200;
|
||||||
|
@ -432,7 +432,8 @@ FocusDispatcher* g_dispatcher = NULL;
|
|||||||
player_id_w *= 2;
|
player_id_w *= 2;
|
||||||
player_name_w = 0;
|
player_name_w = 0;
|
||||||
|
|
||||||
modelView->m_badges = OK_BADGE;
|
modelView->setBadge(OK_BADGE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
irr::video::ITexture* texture = irr_driver->getTexture( file_manager->getTextureFile("green_check.png").c_str() ) ;
|
irr::video::ITexture* texture = irr_driver->getTexture( file_manager->getTextureFile("green_check.png").c_str() ) ;
|
||||||
const int check_size = 128; // TODO: reduce size on smaller resolutions?
|
const int check_size = 128; // TODO: reduce size on smaller resolutions?
|
||||||
@ -1170,7 +1171,7 @@ bool KartSelectionScreen::validateKartChoices()
|
|||||||
// reset all marks, we'll re-add them next if errors are still there
|
// reset all marks, we'll re-add them next if errors are still there
|
||||||
for (int n=0; n<amount; n++)
|
for (int n=0; n<amount; n++)
|
||||||
{
|
{
|
||||||
m_kart_widgets[n].modelView->m_badges = 0;
|
m_kart_widgets[n].modelView->unsetBadge(BAD_BADGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int n=0; n<amount; n++)
|
for (int n=0; n<amount; n++)
|
||||||
@ -1189,13 +1190,13 @@ bool KartSelectionScreen::validateKartChoices()
|
|||||||
{
|
{
|
||||||
std::cout << "--> Setting red badge on player " << n << std::endl;
|
std::cout << "--> Setting red badge on player " << n << std::endl;
|
||||||
// player m is ready, so player n should not choose this name
|
// player m is ready, so player n should not choose this name
|
||||||
m_kart_widgets[n].modelView->m_badges = BAD_BADGE;
|
m_kart_widgets[n].modelView->setBadge(BAD_BADGE);
|
||||||
}
|
}
|
||||||
else if (m_kart_widgets[n].isReady() && !m_kart_widgets[m].isReady())
|
else if (m_kart_widgets[n].isReady() && !m_kart_widgets[m].isReady())
|
||||||
{
|
{
|
||||||
std::cout << "--> Setting red badge on player " << m << std::endl;
|
std::cout << "--> Setting red badge on player " << m << std::endl;
|
||||||
// player n is ready, so player m should not choose this name
|
// player n is ready, so player m should not choose this name
|
||||||
m_kart_widgets[m].modelView->m_badges = BAD_BADGE;
|
m_kart_widgets[m].modelView->setBadge(BAD_BADGE);
|
||||||
}
|
}
|
||||||
else if (m_kart_widgets[n].isReady() && m_kart_widgets[m].isReady())
|
else if (m_kart_widgets[n].isReady() && m_kart_widgets[m].isReady())
|
||||||
{
|
{
|
||||||
|
@ -61,7 +61,7 @@ void OptionsScreenInput::updateInputButtons(DeviceConfig* config)
|
|||||||
// check if another binding already uses this key
|
// check if another binding already uses this key
|
||||||
if (existing_bindings.find(binding_name) != existing_bindings.end())
|
if (existing_bindings.find(binding_name) != existing_bindings.end())
|
||||||
{
|
{
|
||||||
btn->m_badges = BAD_BADGE;
|
btn->setBadge(BAD_BADGE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -77,7 +77,7 @@ void OptionsScreenInput::updateInputButtons(DeviceConfig* config)
|
|||||||
// check if another binding already uses this key
|
// check if another binding already uses this key
|
||||||
if (existing_bindings.find(binding_name) != existing_bindings.end())
|
if (existing_bindings.find(binding_name) != existing_bindings.end())
|
||||||
{
|
{
|
||||||
btn->m_badges = BAD_BADGE;
|
btn->setBadge(BAD_BADGE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -93,7 +93,7 @@ void OptionsScreenInput::updateInputButtons(DeviceConfig* config)
|
|||||||
// check if another binding already uses this key
|
// check if another binding already uses this key
|
||||||
if (existing_bindings.find(binding_name) != existing_bindings.end())
|
if (existing_bindings.find(binding_name) != existing_bindings.end())
|
||||||
{
|
{
|
||||||
btn->m_badges = BAD_BADGE;
|
btn->setBadge(BAD_BADGE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -109,7 +109,7 @@ void OptionsScreenInput::updateInputButtons(DeviceConfig* config)
|
|||||||
// check if another binding already uses this key
|
// check if another binding already uses this key
|
||||||
if (existing_bindings.find(binding_name) != existing_bindings.end())
|
if (existing_bindings.find(binding_name) != existing_bindings.end())
|
||||||
{
|
{
|
||||||
btn->m_badges = BAD_BADGE;
|
btn->setBadge(BAD_BADGE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -137,7 +137,7 @@ void OptionsScreenInput::updateInputButtons(DeviceConfig* config)
|
|||||||
// check if another binding already uses this key
|
// check if another binding already uses this key
|
||||||
if (existing_bindings.find(binding_name) != existing_bindings.end())
|
if (existing_bindings.find(binding_name) != existing_bindings.end())
|
||||||
{
|
{
|
||||||
btn->m_badges = BAD_BADGE;
|
btn->setBadge(BAD_BADGE);
|
||||||
//std::cout << "Setting bad badge!!!!\n";
|
//std::cout << "Setting bad badge!!!!\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -154,7 +154,7 @@ void OptionsScreenInput::updateInputButtons(DeviceConfig* config)
|
|||||||
// check if another binding already uses this key
|
// check if another binding already uses this key
|
||||||
if (existing_bindings.find(binding_name) != existing_bindings.end())
|
if (existing_bindings.find(binding_name) != existing_bindings.end())
|
||||||
{
|
{
|
||||||
btn->m_badges = BAD_BADGE;
|
btn->setBadge(BAD_BADGE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -170,7 +170,7 @@ void OptionsScreenInput::updateInputButtons(DeviceConfig* config)
|
|||||||
// check if another binding already uses this key
|
// check if another binding already uses this key
|
||||||
if (existing_bindings.find(binding_name) != existing_bindings.end())
|
if (existing_bindings.find(binding_name) != existing_bindings.end())
|
||||||
{
|
{
|
||||||
btn->m_badges = BAD_BADGE;
|
btn->setBadge(BAD_BADGE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -186,7 +186,7 @@ void OptionsScreenInput::updateInputButtons(DeviceConfig* config)
|
|||||||
// check if another binding already uses this key
|
// check if another binding already uses this key
|
||||||
if (existing_bindings.find(binding_name) != existing_bindings.end())
|
if (existing_bindings.find(binding_name) != existing_bindings.end())
|
||||||
{
|
{
|
||||||
btn->m_badges = BAD_BADGE;
|
btn->setBadge(BAD_BADGE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -202,7 +202,7 @@ void OptionsScreenInput::updateInputButtons(DeviceConfig* config)
|
|||||||
// check if another binding already uses this key
|
// check if another binding already uses this key
|
||||||
if (existing_bindings.find(binding_name) != existing_bindings.end())
|
if (existing_bindings.find(binding_name) != existing_bindings.end())
|
||||||
{
|
{
|
||||||
btn->m_badges = BAD_BADGE;
|
btn->setBadge(BAD_BADGE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user