nice featured indicator
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8873 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
BIN
data/gui/no-package-featured.png
Normal file
BIN
data/gui/no-package-featured.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 11 KiB |
BIN
data/gui/package-featured.png
Normal file
BIN
data/gui/package-featured.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 12 KiB |
@@ -43,7 +43,7 @@ ListWidget::ListWidget() : Widget(WTYPE_LIST)
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void ListWidget::setIcons(STKModifiedSpriteBank* icons)
|
||||
void ListWidget::setIcons(STKModifiedSpriteBank* icons, int size)
|
||||
{
|
||||
m_use_icons = (icons != NULL);
|
||||
m_icons = icons;
|
||||
@@ -57,12 +57,19 @@ void ListWidget::setIcons(STKModifiedSpriteBank* icons)
|
||||
|
||||
// determine needed height
|
||||
int item_height = 0;
|
||||
const core::array< core::rect<s32> >& rects = m_icons->getPositions();
|
||||
const int count = rects.size();
|
||||
for (int n=0; n<count; n++)
|
||||
if (size > 0)
|
||||
{
|
||||
const int h = rects[n].getHeight();
|
||||
if (h > item_height) item_height = h;
|
||||
item_height = size;
|
||||
}
|
||||
else
|
||||
{
|
||||
const core::array< core::rect<s32> >& rects = m_icons->getPositions();
|
||||
const int count = rects.size();
|
||||
for (int n=0; n<count; n++)
|
||||
{
|
||||
const int h = rects[n].getHeight();
|
||||
if (h > item_height) item_height = h;
|
||||
}
|
||||
}
|
||||
|
||||
if (item_height > 0)
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace GUIEngine
|
||||
* you're done with it (but do not delete it when the list widget is still active)
|
||||
* \pre may only be called after the widget has been added to the screen with add()
|
||||
*/
|
||||
void setIcons(irr::gui::STKModifiedSpriteBank* icons);
|
||||
void setIcons(irr::gui::STKModifiedSpriteBank* icons, int size=-1);
|
||||
|
||||
|
||||
// ---- contents management
|
||||
|
||||
@@ -48,10 +48,16 @@ void AddonsScreen::loadedFromFile()
|
||||
+ "/no-package.png" );
|
||||
video::ITexture* icon3 = irr_driver->getTexture( file_manager->getGUIDir()
|
||||
+ "/package-update.png" );
|
||||
|
||||
video::ITexture* icon4 = irr_driver->getTexture( file_manager->getGUIDir()
|
||||
+ "/package-featured.png");
|
||||
video::ITexture* icon5 = irr_driver->getTexture( file_manager->getGUIDir()
|
||||
+ "/no-package-featured.png");
|
||||
|
||||
m_icon_bank = new irr::gui::STKModifiedSpriteBank( GUIEngine::getGUIEnv());
|
||||
m_icon_installed = m_icon_bank->addTextureAsSprite(icon1);
|
||||
m_icon_not_installed = m_icon_bank->addTextureAsSprite(icon2);
|
||||
m_icon_bank->addTextureAsSprite(icon4);
|
||||
m_icon_bank->addTextureAsSprite(icon5);
|
||||
m_icon_needs_update = m_icon_bank->addTextureAsSprite(icon3);
|
||||
|
||||
GUIEngine::ListWidget* w_list =
|
||||
@@ -74,7 +80,10 @@ void AddonsScreen::init()
|
||||
|
||||
GUIEngine::ListWidget* w_list =
|
||||
getWidget<GUIEngine::ListWidget>("list_addons");
|
||||
w_list->setIcons(m_icon_bank);
|
||||
|
||||
float wanted_icon_height = getHeight()/8.0f;
|
||||
m_icon_bank->setScale(wanted_icon_height/128.0f);
|
||||
w_list->setIcons(m_icon_bank, wanted_icon_height);
|
||||
|
||||
m_type = "kart";
|
||||
|
||||
@@ -133,15 +142,19 @@ void AddonsScreen::loadList()
|
||||
s = _("%s by %s\t%s", addon->getName().c_str(),
|
||||
addon->getDesigner().c_str(),
|
||||
addon->getDateAsString().c_str());
|
||||
|
||||
if (addon->testStatus(Addon::AS_FEATURED))
|
||||
{
|
||||
icon += 2;
|
||||
}
|
||||
|
||||
w_list->addItem(addon->getId(), s.c_str(), icon);
|
||||
|
||||
// Highlight the entry if it's features for normal users,
|
||||
// or if it's not approved in artists debug mode.
|
||||
if( (!UserConfigParams::m_artist_debug_mode &&
|
||||
addon->testStatus(Addon::AS_FEATURED)) ||
|
||||
(UserConfigParams::m_artist_debug_mode &&
|
||||
!addon->testStatus(Addon::AS_APPROVED)))
|
||||
// Highlight if it's not approved in artists debug mode.
|
||||
if(UserConfigParams::m_artist_debug_mode && !addon->testStatus(Addon::AS_APPROVED))
|
||||
{
|
||||
w_list->markItemRed(addon->getId(), true);
|
||||
}
|
||||
}
|
||||
|
||||
getWidget<GUIEngine::RibbonWidget>("category")->setActivated();
|
||||
|
||||
Reference in New Issue
Block a user