introduced more help menus, improved their look and navigation

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3364 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2009-04-05 01:15:38 +00:00
parent 951494cda9
commit 0ad78e1168
5 changed files with 172 additions and 48 deletions

View File

@ -2,10 +2,10 @@
<label align="center" text="SuperTuxKart Options"/>
<ribbon id="options_choice" height="20%" width="75%" align="center">
<icon-button id="audio_video" width="128" height="128" icon="gui/track_random.png" text="General"/>
<icon-button id="players" width="128" height="128" icon="gui/mode_normal.png" text="Weapons"/>
<icon-button id="controls" width="128" height="128" icon="gui/mode_ftl.png" text="Game Modes"/>
<ribbon id="category" height="20%" width="75%" align="center">
<icon-button id="page1" width="128" height="128" icon="gui/track_random.png" text="General"/>
<icon-button id="page2" width="128" height="128" icon="gui/mode_normal.png" text="Weapons"/>
<icon-button id="page3" width="128" height="128" icon="gui/mode_ftl.png" text="Game Modes"/>
</ribbon>
<spacer proportion="1" width="10" proportion="1"/>
@ -39,40 +39,3 @@
<label align="center" text="* Current key bindings can be seen/changed in menu Options"/>
</div>
<!--
"Make your rivals bite dust!"
"Grab blue boxes and nitro"
"Avoid bananas"
"The current key bindings can be seen/changed in the Options->Player Config menu."
"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."
"If you see a button with a lock like the one to the right, you need to complete a challenge to unlock it."
"The 'sharp turn' key allows you to do sharp turns and have better control in tight curves"
"To help you win, there are certain powerups you can grab:"
"BubbleGum - leave a sticky pink puddle behind you"
"Cake - thrown at the closest rival, best on short ranges and long straights"
"Plunger - throw straight to pull an opponent back, or throw while looking back to make one lose sight!"
"Bowling Ball - bounces off walls. If you are looking back,\nit will be thrown backwards."
"Zipper - speed boost"
"Parachute - slows down all karts in a better position!"
"Anchor - slows down greatly the kart in the first position"
Game modes
"Grand Prix: Win victory points by racing through a group of tracks, most points wins (shortest time in case of a tie!) "
"Quick race: Pick a single track, shortest time wins."
"Time Trial: Contains no powerups, so only your driving skills matter!"
"Follow the leader: run for second place, as the last kart\nwill be disqualified every time the counter hits zero.\n Beware : going in front of the leader will get you eliminated too!"
"3 Strikes Battle : only in multiplayer games. Hit others with weapons until they lose all their lives."
if(!unlock_manager->isLocked("followleader"))
-->

54
data/gui/help2.stkgui Normal file
View File

@ -0,0 +1,54 @@
<div x="2%" y="2%" width="96%" height="96%" layout="vertical-row" >
<label align="center" text="SuperTuxKart Options"/>
<ribbon id="category" height="20%" width="75%" align="center">
<icon-button id="page1" width="128" height="128" icon="gui/track_random.png" text="General"/>
<icon-button id="page2" width="128" height="128" icon="gui/mode_normal.png" text="Weapons"/>
<icon-button id="page3" width="128" height="128" icon="gui/mode_ftl.png" text="Game Modes"/>
</ribbon>
<spacer proportion="1" width="10" proportion="1"/>
<label align="center" text="To help you win, there are some powerups you can collect :"/>
<spacer height="25" width="10"/>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" 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"/>
</div>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" icon="textures/cake-icon.png"/>
<spacer width="25" height="25"/>
<label proportion="1" height="100%" align="left" 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"/>
<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!"/>
</div>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" icon="textures/bowling-icon.png"/>
<spacer width="25" height="25"/>
<label proportion="1" height="100%" align="left" word_wrap="true" text="Bowling Ball - bounces off walls. If you are looking back,\nit will be thrown backwards."/>
</div>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" 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!"/>
</div>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" 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"/>
</div>
</div>

48
data/gui/help3.stkgui Normal file
View File

@ -0,0 +1,48 @@
<div x="2%" y="2%" width="96%" height="96%" layout="vertical-row" >
<label align="center" text="SuperTuxKart Options"/>
<ribbon id="category" height="20%" width="75%" align="center">
<icon-button id="page1" width="128" height="128" icon="gui/track_random.png" text="General"/>
<icon-button id="page2" width="128" height="128" icon="gui/mode_normal.png" text="Weapons"/>
<icon-button id="page3" width="128" height="128" icon="gui/mode_ftl.png" text="Game Modes"/>
</ribbon>
<spacer proportion="1" width="10" proportion="1"/>
<label align="center" text="SuperTuxKart features several game modes (TO BE UPDATED FOR NEW GUI LAYOUT!!)"/>
<spacer height="25" width="10"/>
<div width="100%" proportion="1" layout="horizontal-row">
<icon align="center" icon="gui/mode_normal.png"/>
<spacer width="25" height="25"/>
<label proportion="1" height="100%" align="left" word_wrap="true" text="Regular Race (TODO - find a better name :( ) - 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"/>
<spacer width="25" height="25"/>
<label proportion="1" height="100%" align="left" word_wrap="true" 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"/>
<spacer width="25" height="25"/>
<label proportion="1" height="100%" align="left" word_wrap="true" 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"/>
<spacer width="25" height="25"/>
<label proportion="1" height="100%" align="left" word_wrap="true" 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" 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."/>
</div>

View File

@ -285,6 +285,35 @@ namespace StateManager
else if(selection == "controls") replaceTopMostMenu("options_input.stkgui");
}
}
/**
* Callback handling events from the options menus
*/
void menuEventHelp(GUIEngine::Widget* widget, std::string& name)
{
if(name == "init")
{
GUIEngine::RibbonWidget* w = dynamic_cast<GUIEngine::RibbonWidget*>
(GUIEngine::getCurrentScreen()->getWidget("category"));
if(w != NULL)
{
const std::string& screen_name = GUIEngine::getCurrentScreen()->getName();
if(screen_name == "help1.stkgui") w->select( "page1" );
else if(screen_name == "help2.stkgui") w->select( "page2" );
else if(screen_name == "help3.stkgui") w->select( "page3" );
}
}
// -- options
else if(name == "category")
{
std::string selection = ((GUIEngine::RibbonWidget*)widget)->getSelectionName().c_str();
if(selection == "page1") replaceTopMostMenu("help1.stkgui");
else if(selection == "page2") replaceTopMostMenu("help2.stkgui");
else if(selection == "page3") replaceTopMostMenu("help3.stkgui");
}
}
/**
* All widget events will be dispatched to this function; arguments are
@ -309,6 +338,8 @@ namespace StateManager
menuEventTracks(widget, name);
else if( screen_name == "options_av.stkgui" || screen_name == "options_input.stkgui" || screen_name == "options_players.stkgui")
menuEventOptions(widget, name);
else if( screen_name == "help1.stkgui" || screen_name == "help2.stkgui" || screen_name == "help3.stkgui")
menuEventHelp(widget, name);
else
std::cerr << "Warning, unknown menu " << screen_name << " in event callback\n";

View File

@ -175,22 +175,25 @@ void Widget::readCoords(Widget* parent)
if(this->h > (int)parent_h)
{
float ratio = (float)parent_h/this->h;
std::cout << "scaling down, ratio=" << ratio << " parent_h=" << parent_h << " this->h=" << this->h << std::endl;
this->w *= ratio;
this->h *= ratio;
}
if(this->w > (int)parent_w)
{
float ratio = (float)parent_w/this->w;
std::cout << "scaling down, ratio=" << ratio << std::endl;
this->w *= ratio;
this->h *= ratio;
}
}
// -----------------------------------------------------------------------------
#if 0
#pragma mark -
#pragma mark Button Widget
#endif
void ButtonWidget::add()
{
rect<s32> widget_size = rect<s32>(x, y, x + w, y + h);
@ -201,7 +204,12 @@ void ButtonWidget::add()
m_element->setTabOrder(id);
m_element->setTabGroup(false);
}
// -----------------------------------------------------------------------------
#if 0
#pragma mark -
#pragma mark Label Widget
#endif
void LabelWidget::add()
{
rect<s32> widget_size = rect<s32>(x, y, x + w, y + h);
@ -222,7 +230,13 @@ void LabelWidget::add()
m_element->setTabStop(false);
m_element->setTabGroup(false);
}
// -----------------------------------------------------------------------------
#if 0
#pragma mark -
#pragma mark Check Box Widget
#endif
void CheckBoxWidget::add()
{
rect<s32> widget_size = rect<s32>(x, y, x + w, y + h);
@ -233,6 +247,12 @@ void CheckBoxWidget::add()
m_element->setTabOrder(id);
m_element->setTabGroup(false);
}
#if 0
#pragma mark -
#pragma mark Gauge Widget
#endif
// -----------------------------------------------------------------------------
void GaugeWidget::add()
{
@ -243,6 +263,13 @@ void GaugeWidget::add()
m_element->setTabOrder(id);
m_element->setTabGroup(false);
}
#if 0
#pragma mark -
#pragma mark Icon Button
#endif
// -----------------------------------------------------------------------------
IconButtonWidget::IconButtonWidget(const bool clickable)
{
@ -275,6 +302,7 @@ void IconButtonWidget::add()
btn->setImage(texture);
//btn->setDrawBorder(false);
btn->setTabStop(false);
btn->setScaleImage(true);
}
stringw message = m_properties[PROP_TEXT].c_str();
if(message.size() > 0)