Improve main menu based on feedback received

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10381 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-12-08 17:54:58 +00:00
parent 8e6657378b
commit 25f2700794
18 changed files with 39 additions and 7 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -29,16 +29,16 @@
<buttonbar id="menu_toprow" proportion="3" width="75%" align="center">
<icon-button id="story" width="128" height="128"
icon="gui/challenge.png" label_location="hover"
icon="gui/menu_story.png" focus_icon="gui/menu_story_focus.png"
I18N="Main menu button" text="Story Mode"/>
<icon-button id="new" width="128" height="128" icon="gui/main_race.png"
label_location="hover"
<icon-button id="new" width="128" height="128"
icon="gui/menu_race.png" focus_icon="gui/menu_race_focus.png"
I18N="Main menu button" text="Single-player"/>
<icon-button id="multiplayer" width="128" height="128" icon="gui/main_race_multi.png"
label_location="hover"
<icon-button id="multiplayer" width="128" height="128"
icon="gui/menu_multi.png" focus_icon="gui/menu_multi_focus.png"
I18N="Main menu button" text="Multiplayer"/>
<icon-button id="addons" width="128" height="128"
icon="gui/addons.png" label_location="hover"
icon="gui/menu_addons.png" focus_icon="gui/menu_addons_focus.png"
I18N="Main menu button" text="Addons"/>
</buttonbar>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 16 KiB

BIN
data/gui/menu_addons.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
data/gui/menu_multi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
data/gui/menu_race.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

BIN
data/gui/menu_story.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -66,6 +66,7 @@ namespace GUIEngine
\li \ref prop1
\li \ref prop2
\li \ref prop3
\li \ref prop3.1
\li \ref prop4
\li \ref prop5
\li \ref prop6
@ -171,6 +172,7 @@ namespace GUIEngine
area without caring for aspect ratio, and another to respect an aspect
ratio other than the texture's (useful for track screenshots, which
are 4:3 compressed to fit in a power-of-two 256x256 texture)
\note Supports property PROP_FOCUS_ICON
\n
\subsection widget5 WTYPE_CHECKBOX
@ -300,6 +302,12 @@ namespace GUIEngine
IconButtonWidget and DynamicRibbon can enable you to use absolute paths if
you wish, however).
\n
\subsection prop3.1 PROP_FOCUS_ICON
<em> Name in XML files: </em> \c "focus_icon"
For icon buttons. A different icon to show when the item is focused.
\n
\subsection prop4 PROP_TEXT_ALIGN
<em> Name in XML files: </em> \c "text_align"
@ -441,12 +449,15 @@ namespace GUIEngine
\subsection prop16 PROP_LABELS_LOCATION
<em> Name in XML files: </em> \c "label_location"
Currently only used by dynamic ribbons. Decides where the label is. Value
In dynamic ribbons : Decides where the label is. Value
can be "each", "bottom", or "none" (if ommitted, "none" is the default).
"each" means that every item has its own label. "bottom" means there is a
single label for all at the bottom, that displays the name of the current
item.
In non-dynamic ribbons, you can also use value "hover" which will make the
label only visible when the icon is hovered with the mouse.
\n
\subsection prop17 PROP_MAX_ROWS
<em> Name in XML files: </em> \c "max_rows"

View File

@ -204,6 +204,7 @@ if(prop_name != NULL) widget.m_properties[prop_flag] = core::stringc(prop_name).
READ_PROPERTY(align, PROP_ALIGN);
READ_PROPERTY(icon, PROP_ICON);
READ_PROPERTY(focus_icon, PROP_FOCUS_ICON);
READ_PROPERTY(text_align, PROP_TEXT_ALIGN);
READ_PROPERTY(min_value, PROP_MIN_VALUE);
READ_PROPERTY(max_value, PROP_MAX_VALUE);

View File

@ -1398,6 +1398,11 @@ void Skin::drawIconButton(const core::recti &rect, Widget* widget,
{
video::ITexture* t = icon_widget->m_texture;
if (focused && icon_widget->m_highlight_texture != NULL)
{
t = icon_widget->m_highlight_texture;
}
const bool mouseInside =
rect.isPointInside(irr_driver->getDevice()->getCursorControl()
->getPosition());

View File

@ -90,6 +90,7 @@ namespace GUIEngine
PROP_ALIGN,
// PROP_TEXT, // this one is a bit special, can't go along others since it's wide strings
PROP_ICON,
PROP_FOCUS_ICON,
PROP_TEXT_ALIGN,
PROP_MIN_VALUE,
PROP_MAX_VALUE,

View File

@ -74,6 +74,20 @@ void IconButtonWidget::add()
m_texture_w = m_texture->getSize().Width;
m_texture_h = m_texture->getSize().Height;
if (m_properties[PROP_FOCUS_ICON].size() > 0)
{
if (m_icon_path_type == ICON_PATH_TYPE_ABSOLUTE)
{
m_highlight_texture = irr_driver->getTexture(m_properties[PROP_FOCUS_ICON].c_str());
}
else if (m_icon_path_type == ICON_PATH_TYPE_RELATIVE)
{
m_highlight_texture = irr_driver->getTexture((file_manager->getDataDir() + "/" +
m_properties[PROP_FOCUS_ICON]).c_str());
}
}
// irrlicht widgets don't support scaling while keeping aspect ratio
// so, happily, let's implement it ourselves
float useAspectRatio = -1.0f;