game mode selection screen now features a description of the mode
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3598 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
ef2d5b6229
commit
3e62911873
@ -20,12 +20,10 @@
|
||||
|
||||
<spacer proportion="2" width="25"/>
|
||||
|
||||
<buttonbar id="gamemode" height="135" width="85%" align="center">
|
||||
<icon-button id="normal" width="128" height="128" icon="gui/mode_normal.png" text="Snaky Sprint"/>
|
||||
<icon-button id="timetrial" width="128" height="128" icon="gui/mode_tt.png" text="Time Trial"/>
|
||||
<icon-button id="ftl" width="128" height="128" icon="gui/mode_ftl.png" text="Follow the Leader"/>
|
||||
<icon-button id="3strikes" width="128" height="128" icon="gui/mode_3strikes.png" text="3 Strikes Battle"/>
|
||||
</buttonbar>
|
||||
<label width="100%" height="25" text="Select a game mode" align="center" text_align="left" />
|
||||
|
||||
<scrollable_toolbar id="gamemode" height="135" width="85%" text="bottom" align="center" child_width="135" child_height="135" />
|
||||
|
||||
|
||||
<spacer proportion="2" width="25"/>
|
||||
</div>
|
||||
|
@ -49,7 +49,7 @@ A container. Does not do much on itself, but is useful to lay out children autom
|
||||
Supports property PROP_LAYOUT. Of spawn type (<div>...</div>, place children within)
|
||||
"box" is a variant that acts exactly the same but is visible on-screen
|
||||
|
||||
WTYPE_RIBBON_GRID "ribbon_grid", "scrollable_ribbon"
|
||||
WTYPE_RIBBON_GRID "ribbon_grid", "scrollable_ribbon", "scrollable_toolbar"
|
||||
Shows a scrollable grid of icons. NOT of spawn type (<ribbon_grid .../>), contents must be programmatically set at runtime.
|
||||
Property PROP_SQUARE can be set to tell the engine if the ribbon's contents are rectangular or not (this will
|
||||
affect the type of highlighting used). Supports an optional label at the bottom if PROP_TEXT is set.
|
||||
@ -58,8 +58,10 @@ An interesting aspect of PROP_CHILD_WIDTH and PROP_CHILD_HEIGHT is that you can
|
||||
you want (so you can e.g. save textures to a power-of-two size like 256x256, but then show it in 4:3 ratio).
|
||||
Gives a special meaning to the text parameter. A value of "bottom" means to display the name of the selected icon at the bottom.
|
||||
A value of "all" means that each icon shall have its name under it.
|
||||
The "scrollable_ribbon" subtype is a single-line scrollable ribbon; it uses the ribbon-grid implementation since it already
|
||||
supports scrolling so no need to duplicated...
|
||||
The "scrollable_ribbon" and "scrollable_toolbar" subtypes are single-line scrollable ribbons; they use the ribbon-grid
|
||||
implementation since it already supports scrolling so no need to duplicate code... The difference between both is that
|
||||
'scrollable_ribbon always has a value selected (like in a combo box, or radio buttons), while 'scrollable_toolbar' is a
|
||||
scrollable list of buttons that can be pressed to trigger actions.
|
||||
|
||||
WTYPE_MODEL_VIEW "model"
|
||||
Displays a model. Currently incomplete. Contents must be set programmatically.
|
||||
|
@ -110,7 +110,12 @@ void parseScreenFileDiv(irr::io::IrrXMLReader* xml, ptr_vector<Widget>& append_t
|
||||
else if (!strcmp("scrollable_ribbon", xml->getNodeName()))
|
||||
{
|
||||
type = WTYPE_RIBBON_GRID;
|
||||
append_to.push_back(new RibbonGridWidget(1));
|
||||
append_to.push_back(new RibbonGridWidget(true, 1));
|
||||
}
|
||||
else if (!strcmp("scrollable_toolbar", xml->getNodeName()))
|
||||
{
|
||||
type = WTYPE_RIBBON_GRID;
|
||||
append_to.push_back(new RibbonGridWidget(false, 1));
|
||||
}
|
||||
else if (!strcmp("model", xml->getNodeName()))
|
||||
{
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "karts/kart_properties_manager.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
#include "race/race_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -97,7 +98,7 @@ namespace StateManager
|
||||
|
||||
SpinnerWidget* w2 = getCurrentScreen()->getWidget<SpinnerWidget>("player");
|
||||
assert( w2 != NULL );
|
||||
w2->addLabel("Hiker");
|
||||
w2->addLabel("Hiker"); // TODO : don't hardcode
|
||||
w2->addLabel("Auria");
|
||||
w2->addLabel("Conso");
|
||||
w2->addLabel("MiniBjorn");
|
||||
@ -139,12 +140,32 @@ namespace StateManager
|
||||
assert( w != NULL );
|
||||
w->setSelection(user_config->getDefaultDifficulty());
|
||||
|
||||
// TODO - if user arrived to this screen by pressing esc from teh enxt, the behaviour below might be incorrect
|
||||
// it would be better to restore previously set settings.
|
||||
race_manager->setDifficulty( (RaceManager::Difficulty)user_config->getDefaultDifficulty() );
|
||||
|
||||
SpinnerWidget* kartamount = getCurrentScreen()->getWidget<SpinnerWidget>("aikartamount");
|
||||
race_manager->setNumKarts( kartamount->getValue() + 1 );
|
||||
|
||||
RibbonGridWidget* w2 = getCurrentScreen()->getWidget<RibbonGridWidget>("gamemode");
|
||||
assert( w2 != NULL );
|
||||
|
||||
if(!getCurrentScreen()->m_inited)
|
||||
{
|
||||
w2->addItem( _("Snaky Competition\nAll blows allowed, so catch weapons and make clever use of them!"),
|
||||
"normal",
|
||||
"gui/mode_normal.png");
|
||||
w2->addItem( _("Time Trial\nContains no powerups, so only your driving skills matter!"),
|
||||
"timetrial",
|
||||
"gui/mode_tt.png");
|
||||
w2->addItem( _("Follow the Leader\nrun 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!"),
|
||||
"ftl",
|
||||
"gui/mode_ftl.png");
|
||||
w2->addItem( _("3-Strikes Battle\nonly in multiplayer games. Hit others with weapons until they lose all their lives."),
|
||||
"3strikes",
|
||||
"gui/mode_3strikes.png");
|
||||
getCurrentScreen()->m_inited = true;
|
||||
}
|
||||
w2->updateItemDisplay();
|
||||
|
||||
}
|
||||
else if(name == "difficulty")
|
||||
{
|
||||
@ -162,7 +183,7 @@ namespace StateManager
|
||||
else if(name == "gamemode")
|
||||
{
|
||||
// TODO - detect more game modes
|
||||
RibbonWidget* w = dynamic_cast<RibbonWidget*>(widget);
|
||||
RibbonGridWidget* w = dynamic_cast<RibbonGridWidget*>(widget);
|
||||
if(w->getSelectionIDString() == "normal")
|
||||
{
|
||||
StateManager::pushMenu("tracks.stkgui");
|
||||
|
@ -827,7 +827,7 @@ void SpinnerWidget::setValue(const int new_value)
|
||||
#pragma mark Ribbon Grid Widget
|
||||
#endif
|
||||
|
||||
RibbonGridWidget::RibbonGridWidget(const int max_rows)
|
||||
RibbonGridWidget::RibbonGridWidget(const bool combo, const int max_rows)
|
||||
{
|
||||
m_scroll_offset = 0;
|
||||
m_needed_cols = 0;
|
||||
@ -835,6 +835,7 @@ RibbonGridWidget::RibbonGridWidget(const int max_rows)
|
||||
m_has_label = false;
|
||||
|
||||
m_max_rows = max_rows;
|
||||
m_combo = combo;
|
||||
|
||||
m_left_widget = NULL;
|
||||
m_right_widget = NULL;
|
||||
@ -878,7 +879,7 @@ void RibbonGridWidget::add()
|
||||
for(int n=0; n<row_amount; n++)
|
||||
{
|
||||
RibbonWidget* ribbon;
|
||||
if(m_max_rows == 1) // cheap way to detect if it's a regular grid or a scrollable_ribbon. FIXME
|
||||
if(m_combo)
|
||||
ribbon = new RibbonWidget(RIBBON_COMBO);
|
||||
else
|
||||
ribbon = new RibbonWidget(RIBBON_TOOLBAR);
|
||||
@ -911,12 +912,14 @@ void RibbonGridWidget::add()
|
||||
ribbon->add();
|
||||
}
|
||||
|
||||
// add label at bottom
|
||||
// add dynamic label at bottom
|
||||
if(m_has_label)
|
||||
{
|
||||
rect<s32> label_size = rect<s32>(x, y + h - label_height, x+w, y+h);
|
||||
m_label = GUIEngine::getGUIEnv()->addStaticText(L"Selecte a track...", label_size, false, true /* word wrap */, NULL, -1);
|
||||
m_label->setTextAlignment( EGUIA_CENTER, EGUIA_CENTER );
|
||||
// leave room for many lines, just in case
|
||||
rect<s32> label_size = rect<s32>(x, y + h - label_height, x+w, y+h+label_height*5);
|
||||
m_label = GUIEngine::getGUIEnv()->addStaticText(L" ", label_size, false, true /* word wrap */, NULL, -1);
|
||||
m_label->setTextAlignment( EGUIA_CENTER, EGUIA_UPPERLEFT );
|
||||
m_label->setWordWrap(true);
|
||||
}
|
||||
|
||||
// add arrow buttons on each side
|
||||
|
@ -287,6 +287,7 @@ namespace GUIEngine
|
||||
int m_needed_cols;
|
||||
int m_col_amount;
|
||||
int m_max_rows;
|
||||
bool m_combo;
|
||||
|
||||
bool m_has_label;
|
||||
|
||||
@ -294,7 +295,7 @@ namespace GUIEngine
|
||||
Widget* m_left_widget;
|
||||
Widget* m_right_widget;
|
||||
public:
|
||||
RibbonGridWidget(const int max_rows=4);
|
||||
RibbonGridWidget(const bool combo=false, const int max_rows=4);
|
||||
|
||||
void add();
|
||||
bool rightPressed();
|
||||
|
Loading…
x
Reference in New Issue
Block a user