Added Dakal's bottom bar to the main menu, looks nice, makes the news message more visible, and also I'll probably add some more stuff there

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7419 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-01-15 02:25:59 +00:00
parent bd456498a1
commit 0ffb08e285
7 changed files with 47 additions and 20 deletions

View File

@ -16,7 +16,7 @@ title_font, by Marianne Gagnon (Auria), released under CC-BY-SA 3+
screen*.png, by Marianne Gagnon (Auria), including elements from the public domain Tango icon set
Gauge by Dakal, release under CC-BY-SA 3
Gauge and bar by Dakal, released under CC-BY-SA 3
====

BIN
data/gui/bar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

View File

@ -1,6 +1,6 @@
<stkgui>
<div x="5%" y="0" width="90%" height="98%" layout="vertical-row" >
<div x="5%" y="0" width="90%" height="100%" layout="vertical-row" >
<icon id="logo" align="center" proportion="8" width="100%" icon="gui/logo.png"/>
<buttonbar id="menu_toprow" proportion="3" width="75%" align="center">
@ -30,10 +30,13 @@
</buttonbar>
<spacer width="10" proportion="1"/>
<label width="100%" height="10%" id="info_addons"
I18N="In the main screen"
text="Loading news from stkaddons..."
align="center" text_align="center" />
<bottombar layout="vertical-row" width="100%" height="10%">
<label width="100%" height="100%" id="info_addons"
I18N="In the main screen"
text="Loading news from stkaddons..."
align="center" text_align="center" />
</bottombar>
</div>

View File

@ -72,6 +72,12 @@ void Screen::parseScreenFileDiv(irr::io::IrrXMLReader* xml, ptr_vector<Widget>&
w->m_show_bounding_box = true;
append_to.push_back(w);
}
else if (!strcmp("bottombar", xml->getNodeName()))
{
Widget* w = new Widget(WTYPE_DIV);
w->m_bottom_bar = true;
append_to.push_back(w);
}
else if (!strcmp("roundedbox", xml->getNodeName()))
{
Widget* w = new Widget(WTYPE_DIV);

View File

@ -1264,6 +1264,20 @@ void Skin::renderSections(ptr_vector<Widget>* within_vector)
SkinConfig::m_render_params["section::neutral"]);
}
}
else if (widget.isBottomBar())
{
const core::dimension2d<u32> framesize = irr_driver->getFrameSize();
// bar.png is 128 pixels high
const float y_size = (framesize.Height - widget.m_y) / 128.0f;
// there's about 40 empty pixels at the top of bar.png
ITexture* tex = irr_driver->getTexture( file_manager->getGUIDir() + "bar.png" );
irr_driver->getVideoDriver()->draw2DImage(tex, core::rect<s32>(0, widget.m_y - 40*y_size,
framesize.Width, framesize.Height),
core::rect<s32>(core::dimension2di(0,0), tex->getSize())
);
}
else
{
renderSections( &widget.m_children );

View File

@ -62,22 +62,22 @@ Widget::Widget(WidgetType type, bool reserve_id)
{
m_magic_number = 0xCAFEC001;
m_x = -1;
m_y = -1;
m_w = -1;
m_h = -1;
m_x = -1;
m_y = -1;
m_w = -1;
m_h = -1;
m_id = -1;
m_element = NULL;
m_title_font = false;
m_type = type;
m_focusable = true;
m_event_handler = NULL;
m_show_bounding_box = false;
m_element = NULL;
m_title_font = false;
m_type = type;
m_parent = NULL;
m_focusable = true;
m_bottom_bar = false;
m_event_handler = NULL;
m_reserve_id = reserve_id;
m_show_bounding_box = false;
m_supports_multiplayer = false;
m_is_bounding_box_round = false;
m_parent = NULL;
m_reserve_id = reserve_id;
m_supports_multiplayer = false;
m_tab_down_root = -1;
m_tab_up_root = -1;

View File

@ -230,6 +230,8 @@ namespace GUIEngine
/** Set to false if widget is something that should not receive focus */
bool m_focusable;
bool m_bottom_bar;
public:
/**
* This is set to NULL by default; set to something else in a widget to mean
@ -305,6 +307,8 @@ namespace GUIEngine
*/
bool isSelected(const int playerID) const { return m_selected[playerID]; }
bool isBottomBar() const { return m_bottom_bar; }
/**
* \{
* \name Enabling or disabling widgets