Allow theming of powerup/attachment icons (#4258)

* Allow theming of powerup/attachment icons
Icons were optimized with `pngquant` then `optimize_data.sh`

* Change help screens to use icons from icons folder rather than `models`
This commit is contained in:
QwertyChouskie 2020-04-02 22:18:50 -07:00 committed by GitHub
parent f9f5d3ebb1
commit ea4d3c03a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 19 additions and 15 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -32,57 +32,57 @@
<spacer height="2%" width="10"/>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" width="8%" height="100%" icon="gui/icons/bubblegum_icon.png" alt_icon="models/bubblegum-icon.png"/>
<icon align="center" width="8%" height="100%" icon="gui/icons/bubblegum-icon.png"/>
<spacer width="3%" height="100%"/>
<bubble proportion="1" height="100%" text="BubbleGum - protect yourself with a shield, or use while looking back to leave a sticky pink puddle behind you."/>
</div>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" width="8%" height="100%" icon="gui/icons/zipper_collect.png" alt_icon="models/zipper_collect.png"/>
<icon align="center" width="8%" height="100%" icon="gui/icons/zipper_collect.png"/>
<spacer width="3%" height="100%"/>
<bubble proportion="1" height="100%" text="Zipper - will give you a strong speed boost. But beware of not losing control of your kart!"/>
</div>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" width="8%" height="100%" icon="gui/icons/cake_icon.png" alt_icon="models/cake-icon.png"/>
<icon align="center" width="8%" height="100%" icon="gui/icons/cake-icon.png"/>
<spacer width="3%" height="100%"/>
<bubble proportion="1" height="100%"
text="Cake - thrown at the closest rival, best on short ranges and long straights. It also affects other karts close to the explosion."/>
</div>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" width="8%" height="100%" icon="gui/icons/plunger_icon.png" alt_icon="models/plunger-icon.png"/>
<icon align="center" width="8%" height="100%" icon="gui/icons/plunger-icon.png"/>
<spacer width="3%" height="100%"/>
<bubble proportion="1" height="100%" text="Plunger - throw straight to pull an opponent back, or throw while looking back to make one lose sight."/>
</div>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" width="8%" height="100%" icon="gui/icons/bowling_icon.png" alt_icon="models/bowling-icon.png"/>
<icon align="center" width="8%" height="100%" icon="gui/icons/bowling-icon.png"/>
<spacer width="3%" height="100%"/>
<bubble proportion="1" height="100%"
text="Bowling Ball - goes straight until it strikes, it can bounce off walls. If you are looking back, it will be thrown backwards."/>
</div>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" width="8%" height="100%" icon="gui/icons/parachute_icon.png" alt_icon="models/parachute-icon.png"/>
<icon align="center" width="8%" height="100%" icon="gui/icons/parachute-icon.png"/>
<spacer width="3%" height="100%"/>
<bubble proportion="1" height="100%" text="Parachute - slows down all karts in a better position."/>
</div>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" width="8%" height="100%" icon="gui/icons/swap_icon.png" alt_icon="models/swap-icon.png"/>
<icon align="center" width="8%" height="100%" icon="gui/icons/swap-icon.png"/>
<spacer width="3%" height="100%"/>
<bubble proportion="1" height="100%" text="Swapper - gift boxes are transformed into bananas, nitro cans into bubblegums, and vice versa for a short time."/>
</div>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" width="8%" height="100%" icon="gui/icons/rubber_ball_icon.png" alt_icon="models/rubber_ball-icon.png"/>
<icon align="center" width="8%" height="100%" icon="gui/icons/rubber_ball-icon.png"/>
<spacer width="3%" height="100%"/>
<bubble proportion="1" height="100%" text="Basket Ball - bounces after the leader, and might squash and slow down karts down on the way."/>
</div>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" width="8%" height="100%" icon="gui/icons/swatter_icon.png" alt_icon="models/swatter-icon.png"/>
<icon align="center" width="8%" height="100%" icon="gui/icons/swatter-icon.png"/>
<spacer width="3%" height="100%"/>
<bubble proportion="1" height="100%" text="Swatter - will squash karts close by, slowing them down. Can also be used to remove parachutes and bombs."/>
</div>

View File

@ -32,7 +32,7 @@
<spacer height="2%" width="10"/>
<div width="100%" proportion="2" layout="horizontal-row">
<icon align="center" width="8%" height="100%" icon="gui/icons/anchor_icon.png" alt_icon="models/anchor-icon.png"/>
<icon align="center" width="8%" height="100%" icon="gui/icons/anchor-icon.png"/>
<spacer width="3%" height="100%"/>
<bubble proportion="1" height="100%"
I18N="In the help menu"
@ -40,7 +40,7 @@
</div>
<div width="100%" proportion="2" layout="horizontal-row">
<icon align="center" width="8%" height="100%" icon="gui/icons/parachute_icon.png" alt_icon="models/parachute-icon.png"/>
<icon align="center" width="8%" height="100%" icon="gui/icons/parachute-icon.png"/>
<spacer width="3%" height="100%"/>
<bubble proportion="1" height="100%"
I18N="In the help menu"

View File

@ -2416,14 +2416,14 @@ void Skin::drawBadgeOn(const Widget* widget, const core::recti& rect)
if (widget->m_badges & ZIPPER_BADGE)
{
float max_icon_size = 0.43f;
video::ITexture* texture = irr_driver->getTexture(FileManager::MODEL,
video::ITexture* texture = irr_driver->getTexture(FileManager::GUI_ICON,
"zipper_collect.png");
doDrawBadge(texture, rect, max_icon_size, false);
}
if (widget->m_badges & ANCHOR_BADGE)
{
float max_icon_size = 0.43f;
video::ITexture* texture = irr_driver->getTexture(FileManager::MODEL,
video::ITexture* texture = irr_driver->getTexture(FileManager::GUI_ICON,
"anchor-icon.png");
doDrawBadge(texture, rect, max_icon_size, false);
}

View File

@ -23,6 +23,7 @@
#include "graphics/material_manager.hpp"
#include "graphics/sp/sp_base.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/skin.hpp"
#include "io/file_manager.hpp"
AttachmentManager *attachment_manager = 0;
@ -93,7 +94,8 @@ void AttachmentManager::loadModels()
if(iat[i].icon_file)
{
std::string full_icon_path =
file_manager->getAsset(FileManager::MODEL, iat[i].icon_file);
GUIEngine::getSkin()->getThemedIcon(std::string("gui/icons/")
+ iat[i].icon_file);
m_all_icons[iat[i].attachment] =
material_manager->getMaterial(full_icon_path,
/* full_path */ true,

View File

@ -29,6 +29,7 @@
#include "graphics/material.hpp"
#include "graphics/material_manager.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/skin.hpp"
#include "io/file_manager.hpp"
#include "io/xml_node.hpp"
#include "items/bowling.hpp"
@ -453,6 +454,7 @@ void PowerupManager::loadPowerup(PowerupType type, const XMLNode &node)
{
std::string icon_file("");
node.get("icon", &icon_file);
icon_file = GUIEngine::getSkin()->getThemedIcon("gui/icons/" + icon_file);
#ifdef DEBUG
if (icon_file.size() == 0)
@ -464,7 +466,7 @@ void PowerupManager::loadPowerup(PowerupType type, const XMLNode &node)
#endif
m_all_icons[type] = material_manager->getMaterial(icon_file,
/* full_path */ false,
/* full_path */ true,
/*make_permanent */ true);