improvements to layout engine & improvements to help menu
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4488 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
2c0e9c6cb5
commit
2236237e02
data/gui
src/guiengine
BIN
data/gui/gift.png
Normal file
BIN
data/gui/gift.png
Normal file
Binary file not shown.
After (image error) Size: 26 KiB |
@ -18,39 +18,38 @@
|
||||
|
||||
<label align="center" I18N="In the help menu" text="Make your rivals bite dust!"/>
|
||||
|
||||
<spacer height="25" width="10"/>
|
||||
|
||||
<div width="100%" proportion="2" layout="horizontal-row">
|
||||
<icon align="center" icon="textures/bonusblock2.png"/>
|
||||
<icon align="center" width="64" height="64" icon="gui/gift.png"/>
|
||||
<spacer width="25" height="25"/>
|
||||
<label proportion="1" height="100%" align="left" word_wrap="true"
|
||||
<label proportion="2" height="100%" word_wrap="true"
|
||||
I18N="In the help menu"
|
||||
text="Collect blue boxes : they will give you weapons or other powerups"/>
|
||||
</div>
|
||||
|
||||
<div width="100%" proportion="2" layout="horizontal-row">
|
||||
<icon align="center" icon="textures/nitro-particle.png"/>
|
||||
<icon align="center" width="64" height="64" icon="gui/nitro.png"/>
|
||||
<spacer width="25" height="25"/>
|
||||
<label proportion="1" height="100%" align="left" word_wrap="true"
|
||||
<label proportion="3" height="100%" word_wrap="true"
|
||||
I18N="In the help menu"
|
||||
text="Collecting nitro allows you to get speed boosts whenever you wish by pressing the appropriate key. You can see your current level of nitro in the bar at the right of the game screen."/>
|
||||
</div>
|
||||
|
||||
<div width="100%" proportion="2" layout="horizontal-row">
|
||||
<icon align="center" icon="textures/gui_lock.png"/>
|
||||
<icon align="center" width="64" height="64" icon="textures/gui_lock.png"/>
|
||||
<spacer width="25" height="25"/>
|
||||
<label proportion="1" height="100%" align="left" word_wrap="true"
|
||||
<label proportion="2" height="100%" word_wrap="true"
|
||||
I18N="In the help menu"
|
||||
text="If you see a button with a lock like this one, you need to complete a challenge to unlock it."/>
|
||||
</div>
|
||||
|
||||
<label align="left" word_wrap="true" width="100%" proportion="2"
|
||||
<label align="left" word_wrap="true" width="100%" proportion="1"
|
||||
I18N="in the help menu"
|
||||
text="The 'sharp turn' key allows you to do sharp turns and have better control in tight curves"/>
|
||||
|
||||
<spacer proportion="1" width="10"/>
|
||||
<spacer height="10" width="10"/>
|
||||
|
||||
<label align="center" I18N="in the help screen" text="* Current key bindings can be seen/changed in menu Options"/>
|
||||
<spacer height="10" width="10"/>
|
||||
|
||||
</box>
|
||||
<spacer width="50" height="45" />
|
||||
|
@ -20,41 +20,41 @@
|
||||
<spacer height="25" width="10"/>
|
||||
|
||||
<div width="100%" proportion="1" layout="horizontal-row">
|
||||
<icon align="center" icon="textures/bubblegum-icon.png"/>
|
||||
<icon align="center" width="64" height="64" icon="textures/bubblegum-icon.png"/>
|
||||
<spacer width="25" height="25"/>
|
||||
<label proportion="1" height="100%" align="left" word_wrap="true" text="BubbleGum - leave a sticky pink puddle behind you"/>
|
||||
<label proportion="1" height="100%" word_wrap="true" text="BubbleGum - leave a sticky pink puddle behind you"/>
|
||||
</div>
|
||||
|
||||
<div width="100%" proportion="1" layout="horizontal-row">
|
||||
<icon align="center" icon="textures/cake-icon.png"/>
|
||||
<icon align="center" width="64" height="64" icon="textures/cake-icon.png"/>
|
||||
<spacer width="25" height="25"/>
|
||||
<label proportion="1" height="100%" align="left" word_wrap="true"
|
||||
<label proportion="1" height="100%" word_wrap="true"
|
||||
text="Cake - thrown at the closest rival, best on short ranges and long straights"/>
|
||||
</div>
|
||||
|
||||
<div width="100%" proportion="1" layout="horizontal-row">
|
||||
<icon align="center" icon="textures/plunger-icon.png"/>
|
||||
<icon align="center" width="64" height="64" icon="textures/plunger-icon.png"/>
|
||||
<spacer width="25" height="25"/>
|
||||
<label proportion="1" height="100%" align="left" word_wrap="true" text="Plunger - throw straight to pull an opponent back, or throw while looking back to make one lose sight!"/>
|
||||
<label proportion="1" height="100%" word_wrap="true" 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" icon="textures/bowling-icon.png"/>
|
||||
<icon align="center" width="64" height="64" icon="textures/bowling-icon.png"/>
|
||||
<spacer width="25" height="25"/>
|
||||
<label proportion="1" height="100%" align="left" word_wrap="true"
|
||||
<label proportion="1" height="100%" word_wrap="true"
|
||||
text="Bowling Ball - bounces off walls. If you are looking back, it will be thrown backwards."/>
|
||||
</div>
|
||||
|
||||
<div width="100%" proportion="1" layout="horizontal-row">
|
||||
<icon align="center" icon="textures/parachute.png"/>
|
||||
<icon align="center" width="64" height="64" icon="textures/parachute.png"/>
|
||||
<spacer width="25" height="25"/>
|
||||
<label proportion="1" height="100%" align="left" word_wrap="true" text="Parachute - slows down all karts in a better position!"/>
|
||||
<label proportion="1" height="100%" word_wrap="true" text="Parachute - slows down all karts in a better position!"/>
|
||||
</div>
|
||||
|
||||
<div width="100%" proportion="1" layout="horizontal-row">
|
||||
<icon align="center" icon="textures/anchor-icon.png"/>
|
||||
<icon align="center" width="64" height="64" icon="textures/anchor-icon.png"/>
|
||||
<spacer width="25" height="25"/>
|
||||
<label proportion="1" height="100%" align="left" word_wrap="true" text="Anchor - slows down greatly the kart in the first position"/>
|
||||
<label proportion="1" height="100%" word_wrap="true" text="Anchor - slows down greatly the kart in the first position"/>
|
||||
</div>
|
||||
|
||||
</box>
|
||||
|
@ -16,44 +16,40 @@
|
||||
|
||||
<box proportion="1" width="100%" layout="vertical-row">
|
||||
<label align="center" text="SuperTuxKart features several game modes"/>
|
||||
|
||||
<spacer height="25" width="10"/>
|
||||
|
||||
|
||||
<div width="100%" proportion="1" layout="horizontal-row">
|
||||
<icon align="center" icon="gui/mode_normal.png"/>
|
||||
<icon align="center" width="64" height="64" icon="gui/mode_normal.png"/>
|
||||
<spacer width="25" height="25"/>
|
||||
<label proportion="1" height="100%" align="left" word_wrap="true"
|
||||
<label proportion="1" height="100%" word_wrap="true"
|
||||
I18N="In the help menu"
|
||||
text="Regular Race - all blows allowed, so catch weapons and make clever use of them!"/>
|
||||
</div>
|
||||
|
||||
<div width="100%" proportion="1" layout="horizontal-row">
|
||||
<icon align="center" icon="gui/mode_tt.png"/>
|
||||
<icon align="center" width="64" height="64" icon="gui/mode_tt.png"/>
|
||||
<spacer width="25" height="25"/>
|
||||
<label proportion="1" height="100%" align="left" word_wrap="true"
|
||||
<label proportion="1" height="100%" word_wrap="true"
|
||||
I18N="In the help menu"
|
||||
text="Time Trial: Contains no powerups, so only your driving skills matter!"/>
|
||||
</div>
|
||||
|
||||
<div width="100%" proportion="1" layout="horizontal-row">
|
||||
<icon align="center" icon="gui/mode_ftl.png"/>
|
||||
<icon align="center" width="64" height="64" icon="gui/mode_ftl.png"/>
|
||||
<spacer width="25" height="25"/>
|
||||
<label proportion="1" height="100%" align="left" word_wrap="true"
|
||||
<label proportion="1" height="100%" word_wrap="true"
|
||||
I18N="In the help menu"
|
||||
text="Follow the leader: run for second place, as the last kart will be disqualified every time the counter hits zero. Beware : going in front of the leader will get you eliminated too!"/>
|
||||
</div>
|
||||
|
||||
<div width="100%" proportion="1" layout="horizontal-row">
|
||||
<icon align="center" icon="gui/mode_3strikes.png"/>
|
||||
<icon align="center" width="64" height="64" icon="gui/mode_3strikes.png"/>
|
||||
<spacer width="25" height="25"/>
|
||||
<label proportion="1" height="100%" align="left" word_wrap="true"
|
||||
<label proportion="1" height="100%" word_wrap="true"
|
||||
I18N="In the help menu"
|
||||
text="3 Strikes Battle : only in multiplayer games. Hit others with weapons until they lose all their lives."/>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<label proportion="1" width="100%" align="left" word_wrap="true" I18N="In the help menu"
|
||||
<label proportion="1" width="100%" word_wrap="true" I18N="In the help menu"
|
||||
text="* Most of these game modes can also be played in a Grand Prix fashion : instead of playing a single race, you play many in a row. The better you rank, the more points you get. In the end, the player with the most points wins the cup."/>
|
||||
|
||||
</box>
|
||||
|
BIN
data/gui/nitro.png
Normal file
BIN
data/gui/nitro.png
Normal file
Binary file not shown.
After (image error) Size: 12 KiB |
@ -170,8 +170,10 @@ see PROP_ALIGN and PROP_PROPORTION to known more about controlling layouts. Note
|
||||
layed-out div will ignore all x/y coordinates you may give them as parameter.
|
||||
|
||||
PROP_ALIGN "align"
|
||||
For widgets located inside a vertical-row layout div. Value can be "left", "center" or "right". Determines how
|
||||
the x coord of the widget will be determined.
|
||||
For widgets located inside a vertical-row layout div : Changes how the x coord of the widget is determined.
|
||||
value can be "left", "center" or "right".
|
||||
For widgets located inside a horizontal-row layout div : Changes how the y coord of the widget is determined.
|
||||
value can be "top", "center" or "bottom".
|
||||
|
||||
PROP_PROPORTION "proportion"
|
||||
Helps determining widget size dynamically (according to available screen space) in layed-out divs. In a
|
||||
|
@ -166,7 +166,7 @@ void Screen::calculateLayout(ptr_vector<Widget>& widgets, Widget* parent)
|
||||
|
||||
// ---- lay widgets in row
|
||||
int x = parent->x, y = parent->y;
|
||||
for(int n=0; n<widgets_amount; n++)
|
||||
for (int n=0; n<widgets_amount; n++)
|
||||
{
|
||||
std::string prop = widgets[n].m_properties[ PROP_PROPORTION ];
|
||||
if(prop.size() != 0)
|
||||
@ -174,26 +174,37 @@ void Screen::calculateLayout(ptr_vector<Widget>& widgets, Widget* parent)
|
||||
// proportional size
|
||||
int proportion = 1;
|
||||
std::istringstream myStream(prop);
|
||||
if(!(myStream >> proportion))
|
||||
if (!(myStream >> proportion))
|
||||
std::cerr << "/!\\ Warning /!\\ : proportion '" << prop.c_str() << "' is not a number in widget " << widgets[n].m_properties[PROP_ID].c_str() << std::endl;
|
||||
|
||||
const float fraction = (float)proportion/(float)total_proportion;
|
||||
|
||||
if(horizontal)
|
||||
if (horizontal)
|
||||
{
|
||||
|
||||
widgets[n].x = x;
|
||||
|
||||
if(widgets[n].m_properties[ PROP_Y ].size() > 0)
|
||||
widgets[n].y = atoi(widgets[n].m_properties[ PROP_Y ].c_str());
|
||||
else
|
||||
widgets[n].y = y;
|
||||
|
||||
std::string align = widgets[n].m_properties[ PROP_ALIGN ];
|
||||
if (align.size() < 1)
|
||||
{
|
||||
if (widgets[n].m_properties[ PROP_Y ].size() > 0)
|
||||
widgets[n].y = atoi(widgets[n].m_properties[ PROP_Y ].c_str());
|
||||
else
|
||||
widgets[n].y = y;
|
||||
}
|
||||
else if (align == "top") widgets[n].y = y;
|
||||
else if (align == "center") widgets[n].y = y + h/2 - widgets[n].h/2;
|
||||
else if (align == "bottom") widgets[n].y = y + h - widgets[n].h;
|
||||
else std::cerr << "/!\\ Warning /!\\ : alignment '" << align.c_str()
|
||||
<< "' is unknown (widget '" << widgets[n].m_properties[PROP_ID].c_str()
|
||||
<< "', in a horiozntal-row layout)\n";
|
||||
|
||||
widgets[n].w = (int)(left_space*fraction);
|
||||
if(widgets[n].m_properties[PROP_MAX_WIDTH].size() > 0)
|
||||
if (widgets[n].m_properties[PROP_MAX_WIDTH].size() > 0)
|
||||
{
|
||||
const int max_width = atoi( widgets[n].m_properties[PROP_MAX_WIDTH].c_str() );
|
||||
if(widgets[n].w > max_width) widgets[n].w = max_width;
|
||||
if (widgets[n].w > max_width) widgets[n].w = max_width;
|
||||
}
|
||||
|
||||
x += widgets[n].w;
|
||||
@ -202,24 +213,26 @@ void Screen::calculateLayout(ptr_vector<Widget>& widgets, Widget* parent)
|
||||
{
|
||||
widgets[n].h = (int)(left_space*fraction);
|
||||
|
||||
if(widgets[n].m_properties[PROP_MAX_HEIGHT].size() > 0)
|
||||
if (widgets[n].m_properties[PROP_MAX_HEIGHT].size() > 0)
|
||||
{
|
||||
const int max_height = atoi( widgets[n].m_properties[PROP_MAX_HEIGHT].c_str() );
|
||||
if(widgets[n].h > max_height) widgets[n].h = max_height;
|
||||
}
|
||||
|
||||
std::string align = widgets[n].m_properties[ PROP_ALIGN ];
|
||||
if(align.size() < 1)
|
||||
if (align.size() < 1)
|
||||
{
|
||||
if(widgets[n].m_properties[ PROP_X ].size() > 0)
|
||||
if (widgets[n].m_properties[ PROP_X ].size() > 0)
|
||||
widgets[n].x = atoi(widgets[n].m_properties[ PROP_X ].c_str());
|
||||
else
|
||||
widgets[n].x = x;
|
||||
}
|
||||
else if(align == "left") widgets[n].x = x;
|
||||
else if(align == "center") widgets[n].x = x + w/2 - widgets[n].w/2;
|
||||
else if(align == "right") widgets[n].x = x + w - widgets[n].w;
|
||||
else std::cerr << "/!\\ Warning /!\\ : alignment '" << align.c_str() << "' is unknown in widget " << widgets[n].m_properties[PROP_ID].c_str() << std::endl;
|
||||
else if (align == "left") widgets[n].x = x;
|
||||
else if (align == "center") widgets[n].x = x + w/2 - widgets[n].w/2;
|
||||
else if (align == "right") widgets[n].x = x + w - widgets[n].w;
|
||||
else std::cerr << "/!\\ Warning /!\\ : alignment '" << align.c_str()
|
||||
<< "' is unknown (widget '" << widgets[n].m_properties[PROP_ID].c_str()
|
||||
<< "', in a vertical-row layout)\n";
|
||||
widgets[n].y = y;
|
||||
|
||||
y += widgets[n].h;
|
||||
@ -229,14 +242,23 @@ void Screen::calculateLayout(ptr_vector<Widget>& widgets, Widget* parent)
|
||||
{
|
||||
// absolute size
|
||||
|
||||
if(horizontal)
|
||||
if (horizontal)
|
||||
{
|
||||
widgets[n].x = x;
|
||||
|
||||
if(widgets[n].m_properties[ PROP_Y ].size() > 0)
|
||||
widgets[n].y = atoi(widgets[n].m_properties[ PROP_Y ].c_str());
|
||||
else
|
||||
widgets[n].y = y;
|
||||
std::string align = widgets[n].m_properties[ PROP_ALIGN ];
|
||||
|
||||
if (align.size() < 1)
|
||||
{
|
||||
if (widgets[n].m_properties[ PROP_Y ].size() > 0)
|
||||
widgets[n].y = atoi(widgets[n].m_properties[ PROP_Y ].c_str());
|
||||
else
|
||||
widgets[n].y = y;
|
||||
}
|
||||
else if (align == "top") widgets[n].y = y;
|
||||
else if (align == "center") widgets[n].y = y + h/2 - widgets[n].h/2;
|
||||
else if (align == "bottom") widgets[n].y = y + h - widgets[n].h;
|
||||
else std::cerr << "/!\\ Warning /!\\ : alignment '" << align.c_str() << "' is unknown in widget " << widgets[n].m_properties[PROP_ID].c_str() << std::endl;
|
||||
|
||||
x += widgets[n].w;
|
||||
}
|
||||
@ -246,16 +268,16 @@ void Screen::calculateLayout(ptr_vector<Widget>& widgets, Widget* parent)
|
||||
|
||||
std::string align = widgets[n].m_properties[ PROP_ALIGN ];
|
||||
|
||||
if(align.size() < 1)
|
||||
if (align.size() < 1)
|
||||
{
|
||||
if(widgets[n].m_properties[ PROP_X ].size() > 0)
|
||||
if (widgets[n].m_properties[ PROP_X ].size() > 0)
|
||||
widgets[n].x = atoi(widgets[n].m_properties[ PROP_X ].c_str());
|
||||
else
|
||||
widgets[n].x = x;
|
||||
}
|
||||
else if(align == "left") widgets[n].x = x;
|
||||
else if(align == "center") widgets[n].x = x + w/2 - widgets[n].w/2;
|
||||
else if(align == "right") widgets[n].x = x + w - widgets[n].w;
|
||||
else if (align == "left") widgets[n].x = x;
|
||||
else if (align == "center") widgets[n].x = x + w/2 - widgets[n].w/2;
|
||||
else if (align == "right") widgets[n].x = x + w - widgets[n].w;
|
||||
else std::cerr << "/!\\ Warning /!\\ : alignment '" << align.c_str() << "' is unknown in widget " << widgets[n].m_properties[PROP_ID].c_str() << std::endl;
|
||||
widgets[n].y = y;
|
||||
|
||||
|
@ -702,7 +702,7 @@ void Skin::drawRibbonChild(const core::rect< s32 > &rect, Widget* widget, const
|
||||
const int y_shift_up = (int)(rect.getHeight() * (outgrow/2.0f));
|
||||
|
||||
core::rect< s32 > rect2( position2d< s32 >(rect.UpperLeftCorner.X + x_gap,
|
||||
rect.UpperLeftCorner.Y - y_shift_up),
|
||||
rect.UpperLeftCorner.Y - y_shift_up),
|
||||
dimension2d< s32 >(rectWidth, rectHeight) );
|
||||
|
||||
GUIEngine::getDriver()->draw2DImage(tex_bubble, rect2, source_area,
|
||||
|
@ -34,8 +34,8 @@ void LabelWidget::add()
|
||||
stringw& message = m_text;
|
||||
|
||||
EGUI_ALIGNMENT align = EGUIA_UPPERLEFT;
|
||||
if(m_properties[PROP_TEXT_ALIGN] == "center") align = EGUIA_CENTER;
|
||||
else if(m_properties[PROP_TEXT_ALIGN] == "right") align = EGUIA_LOWERRIGHT;
|
||||
if (m_properties[PROP_TEXT_ALIGN] == "center") align = EGUIA_CENTER;
|
||||
else if (m_properties[PROP_TEXT_ALIGN] == "right") align = EGUIA_LOWERRIGHT;
|
||||
EGUI_ALIGNMENT valign = EGUIA_CENTER ; // TODO - make confiurable through XML file?
|
||||
|
||||
IGUIStaticText* irrwidget = GUIEngine::getGUIEnv()->addStaticText(message.c_str(), widget_size, false, word_wrap, m_parent, -1);
|
||||
|
Loading…
Reference in New Issue
Block a user