Added new roundedbox widget

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5982 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2010-09-13 23:22:58 +00:00
parent 209d9582a8
commit 40d3d2e5de
11 changed files with 54 additions and 13 deletions

View File

@ -1,8 +1,8 @@
<stkgui> <stkgui>
<div x="2%" y="5%" width="100%" height="95%" layout="vertical-row" id="div"> <div x="2%" y="5%" width="100%" height="95%" layout="vertical-row" id="div">
<placeholder id="result-table" width="96%" proportion="1"> <roundedbox id="result-table" width="90%" proportion="1" align="center">
<!-- Contents is added programatically --> <!-- Contents is added programatically -->
</placeholder> </roundedbox>
<spacer height="10" width="96%"/> <spacer height="10" width="96%"/>
<!-- The actual button texts will vary depending on what type of race <!-- The actual button texts will vary depending on what type of race
was being run, and if something was unlocked etc. So we don't was being run, and if something was unlocked etc. So we don't

View File

@ -175,7 +175,12 @@ when the border that intersect at this corner are enabled.
<element type="section" image="glass/glass_section.png" <element type="section" image="glass/glass_section.png"
left_border="15" right_border="15" top_border="15" bottom_border="15" left_border="15" right_border="15" top_border="15" bottom_border="15"
hborder_out_portion="1.0" vborder_out_portion="0.2" /> hborder_out_portion="1.0" vborder_out_portion="0.2" />
<!-- Stateless -->
<element type="rounded_section" image="glass/glass_rsection.png"
left_border="15" right_border="15" top_border="15" bottom_border="15"
hborder_out_portion="1.0" vborder_out_portion="0.2" />
<!-- Stateless --> <!-- Stateless -->
<element type="window" image="glass/dialog.png" <element type="window" image="glass/dialog.png"
left_border="7" right_border="7" top_border="50" bottom_border="50" left_border="7" right_border="7" top_border="50" bottom_border="50"

View File

@ -175,7 +175,12 @@ when the border that intersect at this corner are enabled.
<element type="section" image="ocean/glass_section.png" <element type="section" image="ocean/glass_section.png"
left_border="15" right_border="15" top_border="15" bottom_border="15" left_border="15" right_border="15" top_border="15" bottom_border="15"
hborder_out_portion="1.0" vborder_out_portion="0.2" /> hborder_out_portion="1.0" vborder_out_portion="0.2" />
<!-- Stateless -->
<element type="rounded_section" image="glass/glass_rsection.png"
left_border="15" right_border="15" top_border="15" bottom_border="15"
hborder_out_portion="1.0" vborder_out_portion="0.2" />
<!-- Stateless --> <!-- Stateless -->
<element type="window" image="ocean/dialog.png" <element type="window" image="ocean/dialog.png"
left_border="7" right_border="7" top_border="50" bottom_border="50" left_border="7" right_border="7" top_border="50" bottom_border="50"

View File

@ -175,7 +175,12 @@ when the border that intersect at this corner are enabled.
<element type="section" image="peach/glass_section.png" <element type="section" image="peach/glass_section.png"
left_border="15" right_border="15" top_border="15" bottom_border="15" left_border="15" right_border="15" top_border="15" bottom_border="15"
hborder_out_portion="1.0" vborder_out_portion="0.2" /> hborder_out_portion="1.0" vborder_out_portion="0.2" />
<!-- Stateless -->
<element type="rounded_section" image="glass/glass_rsection.png"
left_border="15" right_border="15" top_border="15" bottom_border="15"
hborder_out_portion="1.0" vborder_out_portion="0.2" />
<!-- Stateless --> <!-- Stateless -->
<element type="window" image="peach/dialog.png" <element type="window" image="peach/dialog.png"
left_border="7" right_border="7" top_border="50" bottom_border="50" left_border="7" right_border="7" top_border="50" bottom_border="50"

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -72,6 +72,13 @@ void Screen::parseScreenFileDiv(irr::io::IrrXMLReader* xml, ptr_vector<Widget>&
w->m_show_bounding_box = true; w->m_show_bounding_box = true;
append_to.push_back(w); append_to.push_back(w);
} }
else if (!strcmp("roundedbox", xml->getNodeName()))
{
Widget* w = new Widget(WTYPE_DIV);
w->m_show_bounding_box = true;
w->m_is_bounding_box_round = true;
append_to.push_back(w);
}
else if (!strcmp("ribbon", xml->getNodeName())) else if (!strcmp("ribbon", xml->getNodeName()))
{ {
append_to.push_back(new RibbonWidget()); append_to.push_back(new RibbonWidget());
@ -227,6 +234,8 @@ if(prop_name != NULL) widget.m_properties[prop_flag] = prop_name; else widget.m_
return; return;
if (!strcmp("placeholder", xml->getNodeName())) if (!strcmp("placeholder", xml->getNodeName()))
return; return;
if (!strcmp("roundedbox", xml->getNodeName()))
return;
// we're done parsing this 'ribbon', return one step back in the recursive call // we're done parsing this 'ribbon', return one step back in the recursive call
if (!strcmp("ribbon", xml->getNodeName()) || if (!strcmp("ribbon", xml->getNodeName()) ||

View File

@ -1238,15 +1238,28 @@ void Skin::renderSections(ptr_vector<Widget>* within_vector)
{ {
Widget& widget = (*within_vector)[n]; Widget& widget = (*within_vector)[n];
if(widget.m_type == WTYPE_DIV) if (widget.m_type == WTYPE_DIV)
{ {
if(widget.m_show_bounding_box) if (widget.m_show_bounding_box)
{ {
core::rect< s32 > rect = core::rect<s32>(widget.m_x, if (widget.m_is_bounding_box_round)
widget.m_y, {
widget.m_x + widget.m_w, core::rect< s32 > rect = core::rect<s32>(widget.m_x,
widget.m_y + widget.m_h ); widget.m_y,
drawBoxFromStretchableTexture(&widget, rect, SkinConfig::m_render_params["section::neutral"]); widget.m_x + widget.m_w,
widget.m_y + widget.m_h );
drawBoxFromStretchableTexture(&widget, rect,
SkinConfig::m_render_params["rounded_section::neutral"]);
}
else
{
core::rect< s32 > rect = core::rect<s32>(widget.m_x,
widget.m_y,
widget.m_x + widget.m_w,
widget.m_y + widget.m_h );
drawBoxFromStretchableTexture(&widget, rect,
SkinConfig::m_render_params["section::neutral"]);
}
} }
else else
{ {

View File

@ -74,6 +74,7 @@ Widget::Widget(WidgetType type, bool reserve_id)
m_event_handler = NULL; m_event_handler = NULL;
m_show_bounding_box = false; m_show_bounding_box = false;
m_is_bounding_box_round = false;
m_parent = NULL; m_parent = NULL;
m_reserve_id = reserve_id; m_reserve_id = reserve_id;
m_supports_multiplayer = false; m_supports_multiplayer = false;

View File

@ -262,6 +262,9 @@ namespace GUIEngine
/** Whether to show a bounding box around this widget (used for sections) */ /** Whether to show a bounding box around this widget (used for sections) */
bool m_show_bounding_box; bool m_show_bounding_box;
/** Only used if m_show_bounding_box is true */
bool m_is_bounding_box_round;
/** Used in two cases : /** Used in two cases :
1) For 'placeholder' divisions; at the time the layout is created, there is nothing to 1) For 'placeholder' divisions; at the time the layout is created, there is nothing to
place there yet, but we know there eventually will. So in this case pass 'true' to the place there yet, but we know there eventually will. So in this case pass 'true' to the