Show 'hourclass' loading badge on addons menu item while it's loading

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8857 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria
2011-06-07 01:43:04 +00:00
parent 769333c1fe
commit 50234db02f
5 changed files with 36 additions and 6 deletions

View File

@@ -4,7 +4,8 @@ released under CC-BY-SA 3+
Except :
main_*.png icons, released under Creative-Commons BY-SA 3, By yeKcim (Anthony Carré)
main_*.png icons, hourglass, back, back_addons, next_addons, package.png
released under Creative-Commons BY-SA 3, By yeKcim (Anthony Carré)
mode_tt, released under Creative-Commons BY-SA 3, incorporatings artwork from yeKcim and onyum.com

BIN
data/gui/hourglass.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@@ -1669,6 +1669,12 @@ void Skin::drawBadgeOn(const Widget* widget, const core::rect<s32>& rect)
video::ITexture* texture = irr_driver->getTexture(file_manager->getGUIDir() + "gamepad.png");
doDrawBadge(texture, rect, max_icon_size, true);
}
if (widget->m_badges & LOADING_BADGE)
{
float max_icon_size = 0.43f;
video::ITexture* texture = irr_driver->getTexture(file_manager->getGUIDir() + "hourglass.png");
doDrawBadge(texture, rect, max_icon_size, true);
}
}
// -----------------------------------------------------------------------------

View File

@@ -69,7 +69,9 @@ namespace GUIEngine
/** A gamepad icon */
GAMEPAD_BADGE = 16,
/** A keyboard icon */
KEYBOARD_BADGE = 32
KEYBOARD_BADGE = 32,
/** An hourglass badge to indocate loading */
LOADING_BADGE = 64
};

View File

@@ -97,12 +97,21 @@ void MainMenuScreen::init()
// the key bindings for the first player the default again.
input_manager->getDeviceList()->clearLatestUsedDevice();
if(!addons_manager->onlineReady() ||
UserConfigParams::m_internet_status!=NetworkHttp::IPERM_ALLOWED )
if (UserConfigParams::m_internet_status!=NetworkHttp::IPERM_ALLOWED)
{
IconButtonWidget* w = this->getWidget<IconButtonWidget>("addons");
w->setDeactivated();
w->resetAllBadges();
w->setBadge(BAD_BADGE);
}
else if (!addons_manager->onlineReady())
{
IconButtonWidget* w = this->getWidget<IconButtonWidget>("addons");
w->setDeactivated();
w->resetAllBadges();
w->setBadge(LOADING_BADGE);
}
LabelWidget* w = this->getWidget<LabelWidget>("info_addons");
const core::stringw &news_text = news_manager->getNextNewsMessage();
@@ -116,11 +125,23 @@ void MainMenuScreen::onUpdate(float delta, irr::video::IVideoDriver* driver)
IconButtonWidget* addons_icon = this->getWidget<IconButtonWidget>("addons");
if (addons_icon != NULL)
{
if(!addons_manager->onlineReady() ||
UserConfigParams::m_internet_status!=NetworkHttp::IPERM_ALLOWED )
if(UserConfigParams::m_internet_status!=NetworkHttp::IPERM_ALLOWED )
{
addons_icon->setDeactivated();
addons_icon->resetAllBadges();
addons_icon->setBadge(BAD_BADGE);
}
else if (!addons_manager->onlineReady())
{
addons_icon->setDeactivated();
addons_icon->resetAllBadges();
addons_icon->setBadge(LOADING_BADGE);
}
else
{
addons_icon->setActivated();
addons_icon->resetAllBadges();
}
}
LabelWidget* w = this->getWidget<LabelWidget>("info_addons");