Disable the AI karts amount widget when selection 3 Strikes Battle, because we have no AI for this mode
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4759 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -318,7 +318,8 @@ void Skin::drawBgImage()
|
||||
GUIEngine::getDriver()->draw2DImage(bg_image, dest, source_area, 0 /* no clipping */, 0, false /* alpha */);
|
||||
}
|
||||
|
||||
void Skin::drawBoxFromStretchableTexture(SkinWidgetContainer* w, const core::rect< s32 > &dest, BoxRenderParams& params)
|
||||
void Skin::drawBoxFromStretchableTexture(SkinWidgetContainer* w, const core::rect< s32 > &dest,
|
||||
BoxRenderParams& params, bool deactivated)
|
||||
{
|
||||
// check if widget moved. if so, recalculate coords
|
||||
if(w->x != dest.UpperLeftCorner.X || w->y != dest.UpperLeftCorner.Y ||
|
||||
@@ -362,7 +363,7 @@ void Skin::drawBoxFromStretchableTexture(SkinWidgetContainer* w, const core::rec
|
||||
+----l--------------------m----n
|
||||
*/
|
||||
|
||||
if(!w->dest_areas_inited)
|
||||
if (!w->dest_areas_inited)
|
||||
{
|
||||
w->dest_x = dest.UpperLeftCorner.X;
|
||||
w->dest_y = dest.UpperLeftCorner.Y;
|
||||
@@ -449,9 +450,9 @@ void Skin::drawBoxFromStretchableTexture(SkinWidgetContainer* w, const core::rec
|
||||
w->dest_areas_inited = true;
|
||||
}
|
||||
|
||||
if(vertical_flip)
|
||||
if (vertical_flip)
|
||||
{
|
||||
if(!w->dest_areas_yflip_inited)
|
||||
if (!w->dest_areas_yflip_inited)
|
||||
{
|
||||
#define FLIP_Y( X ) { const int y1 = X.UpperLeftCorner.Y - w->dest_y; \
|
||||
const int y2 = X.LowerRightCorner.Y - w->dest_y; \
|
||||
@@ -508,7 +509,8 @@ X##_yflip.LowerRightCorner.Y = w->dest_y + (w->dest_y2 - w->dest_y) - y1;}
|
||||
|
||||
SColor* colorptr = NULL;
|
||||
|
||||
if ( (w->r != -1 && w->g != -1 && w->b != -1) || ID_DEBUG)
|
||||
// create a color object
|
||||
if ( (w->r != -1 && w->g != -1 && w->b != -1) || ID_DEBUG || deactivated)
|
||||
{
|
||||
SColor thecolor(255, w->r, w->g, w->b);
|
||||
colorptr = new SColor[4]();
|
||||
@@ -517,7 +519,9 @@ X##_yflip.LowerRightCorner.Y = w->dest_y + (w->dest_y2 - w->dest_y) - y1;}
|
||||
colorptr[2] = thecolor;
|
||||
colorptr[3] = thecolor;
|
||||
}
|
||||
if (ID_DEBUG)
|
||||
|
||||
// set it to transluscent
|
||||
if (ID_DEBUG || deactivated)
|
||||
{
|
||||
colorptr[0].setAlpha(100);
|
||||
colorptr[1].setAlpha(100);
|
||||
@@ -597,16 +601,28 @@ void Skin::drawButton(Widget* w, const core::rect< s32 > &rect, const bool press
|
||||
sized_rect.LowerRightCorner.Y = center.Y + (int)(((int)rect.LowerRightCorner.Y - (int)center.Y)*texture_size);
|
||||
|
||||
if (focused)
|
||||
drawBoxFromStretchableTexture(w, sized_rect, SkinConfig::m_render_params["button::focused"]);
|
||||
{
|
||||
drawBoxFromStretchableTexture(w, sized_rect, SkinConfig::m_render_params["button::focused"],
|
||||
w->m_deactivated);
|
||||
}
|
||||
else
|
||||
drawBoxFromStretchableTexture(w, sized_rect, SkinConfig::m_render_params["button::neutral"]);
|
||||
{
|
||||
drawBoxFromStretchableTexture(w, sized_rect, SkinConfig::m_render_params["button::neutral"],
|
||||
w->m_deactivated);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (focused)
|
||||
drawBoxFromStretchableTexture(w, rect, SkinConfig::m_render_params["button::focused"]);
|
||||
{
|
||||
drawBoxFromStretchableTexture(w, rect, SkinConfig::m_render_params["button::focused"],
|
||||
w->m_deactivated);
|
||||
}
|
||||
else
|
||||
drawBoxFromStretchableTexture(w, rect, SkinConfig::m_render_params["button::neutral"]);
|
||||
{
|
||||
drawBoxFromStretchableTexture(w, rect, SkinConfig::m_render_params["button::neutral"],
|
||||
w->m_deactivated);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -616,6 +632,9 @@ void Skin::drawRibbon(const core::rect< s32 > &rect, Widget* widget, const bool
|
||||
|
||||
void Skin::drawRibbonChild(const core::rect< s32 > &rect, Widget* widget, const bool pressed, bool focused)
|
||||
{
|
||||
//TODO: do something better than hide it when a widget is deactivated?
|
||||
if (widget->m_deactivated) return;
|
||||
|
||||
const int playerID = 0; // FIXME : don't hardcode player 0 ?
|
||||
|
||||
bool mark_selected = widget->isSelected(playerID);
|
||||
@@ -831,13 +850,8 @@ void Skin::drawSpinnerBody(const core::rect< s32 > &rect, Widget* widget, const
|
||||
BoxRenderParams& params = (focused || pressed) ? SkinConfig::m_render_params["spinner::focused"] :
|
||||
SkinConfig::m_render_params["spinner::neutral"];
|
||||
|
||||
// FIXME: temporary only
|
||||
if (widget->isFocusedForPlayer(1))
|
||||
{
|
||||
//widget->r = 0;
|
||||
//widget->g = 200;
|
||||
//widget->b = 255;
|
||||
|
||||
core::rect< s32 > rect2 = rect;
|
||||
rect2.UpperLeftCorner.X += 2;
|
||||
rect2.UpperLeftCorner.Y -= 3;
|
||||
@@ -847,9 +861,6 @@ void Skin::drawSpinnerBody(const core::rect< s32 > &rect, Widget* widget, const
|
||||
}
|
||||
else if (widget->isFocusedForPlayer(2))
|
||||
{
|
||||
//widget->r = 120;
|
||||
//widget->g = 0;
|
||||
///widget->b = 120;
|
||||
core::rect< s32 > rect2 = rect;
|
||||
rect2.UpperLeftCorner.X += 2;
|
||||
rect2.UpperLeftCorner.Y -= 3;
|
||||
@@ -859,9 +870,6 @@ void Skin::drawSpinnerBody(const core::rect< s32 > &rect, Widget* widget, const
|
||||
}
|
||||
else if (widget->isFocusedForPlayer(3))
|
||||
{
|
||||
//widget->r = 255;
|
||||
//widget->g = 0;
|
||||
//widget->b = 0;
|
||||
core::rect< s32 > rect2 = rect;
|
||||
rect2.UpperLeftCorner.X += 2;
|
||||
rect2.UpperLeftCorner.Y -= 3;
|
||||
@@ -869,16 +877,10 @@ void Skin::drawSpinnerBody(const core::rect< s32 > &rect, Widget* widget, const
|
||||
rect2.LowerRightCorner.Y += 5;
|
||||
drawBoxFromStretchableTexture(widget, rect2, SkinConfig::m_render_params["squareFocusHalo4::neutral"]);
|
||||
}
|
||||
/*
|
||||
else
|
||||
{
|
||||
widget->r = -1;
|
||||
widget->g = -1;
|
||||
widget->b = -1;
|
||||
}*/
|
||||
|
||||
core::rect< s32 > sized_rect = rect;
|
||||
if (m_dialog && m_dialog_size < 1.0f && widget->m_parent != NULL && widget->m_parent->getType() == gui::EGUIET_WINDOW)
|
||||
if (m_dialog && m_dialog_size < 1.0f && widget->m_parent != NULL &&
|
||||
widget->m_parent->getType() == gui::EGUIET_WINDOW)
|
||||
{
|
||||
core::position2d<u32> center = core::position2d<u32>(irr_driver->getFrameSize()/2);
|
||||
const float texture_size = sin(m_dialog_size*M_PI*0.5f);
|
||||
@@ -892,12 +894,12 @@ void Skin::drawSpinnerBody(const core::rect< s32 > &rect, Widget* widget, const
|
||||
sized_rect.LowerRightCorner.Y = center.Y + (int)(((int)rect.LowerRightCorner.Y - (int)center.Y)*texture_size);
|
||||
}
|
||||
|
||||
drawBoxFromStretchableTexture(widget, sized_rect, params);
|
||||
drawBoxFromStretchableTexture(widget, sized_rect, params, widget->m_deactivated);
|
||||
|
||||
|
||||
// ---- If this spinner is of "gauge" type, draw filling
|
||||
const SpinnerWidget* w = dynamic_cast<const SpinnerWidget*>(widget);
|
||||
if (w->isGauge())
|
||||
if (w->isGauge() && !w->m_deactivated)
|
||||
{
|
||||
const int handle_size = (int)( widget->h*params.left_border/(float)params.getImage()->getSize().Height );
|
||||
const float value = (float)(w->getValue() - w->getMin()) / (w->getMax() - w->getMin());
|
||||
@@ -923,8 +925,8 @@ void Skin::drawSpinnerBody(const core::rect< s32 > &rect, Widget* widget, const
|
||||
}
|
||||
|
||||
void Skin::drawSpinnerChild(const core::rect< s32 > &rect, Widget* widget, const bool pressed, bool focused)
|
||||
{
|
||||
if(pressed)
|
||||
{
|
||||
if (pressed)
|
||||
{
|
||||
Widget* spinner = widget->m_event_handler;
|
||||
int areas = 0;
|
||||
@@ -941,13 +943,17 @@ void Skin::drawSpinnerChild(const core::rect< s32 > &rect, Widget* widget, const
|
||||
|
||||
BoxRenderParams& params = SkinConfig::m_render_params["spinner::down"];
|
||||
params.areas = areas;
|
||||
drawBoxFromStretchableTexture(widget, rect, params);
|
||||
drawBoxFromStretchableTexture(widget, rect, params, widget->m_deactivated);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Skin::drawIconButton(const core::rect< s32 > &rect, Widget* widget, const bool pressed, bool focused)
|
||||
{
|
||||
//TODO: do something better than hide it when a widget is deactivated?
|
||||
if (widget->m_deactivated) return;
|
||||
|
||||
|
||||
if (focused)
|
||||
{
|
||||
int grow = 45;
|
||||
@@ -1011,23 +1017,22 @@ void Skin::drawIconButton(const core::rect< s32 > &rect, Widget* widget, const b
|
||||
|
||||
void Skin::drawCheckBox(const core::rect< s32 > &rect, Widget* widget, bool focused)
|
||||
{
|
||||
//TODO: do something better than hide it when a widget is deactivated?
|
||||
if (widget->m_deactivated) return;
|
||||
|
||||
CheckBoxWidget* w = dynamic_cast<CheckBoxWidget*>(widget);
|
||||
|
||||
ITexture* texture;
|
||||
|
||||
if(w->getState() == true)
|
||||
if (w->getState() == true)
|
||||
{
|
||||
if(focused)
|
||||
texture = SkinConfig::m_render_params["checkbox::focused+checked"].getImage();
|
||||
else
|
||||
texture = SkinConfig::m_render_params["checkbox::neutral+checked"].getImage();
|
||||
if (focused) texture = SkinConfig::m_render_params["checkbox::focused+checked"].getImage();
|
||||
else texture = SkinConfig::m_render_params["checkbox::neutral+checked"].getImage();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(focused)
|
||||
texture = SkinConfig::m_render_params["checkbox::focused+unchecked"].getImage();
|
||||
else
|
||||
texture = SkinConfig::m_render_params["checkbox::neutral+unchecked"].getImage();
|
||||
if (focused) texture = SkinConfig::m_render_params["checkbox::focused+unchecked"].getImage();
|
||||
else texture = SkinConfig::m_render_params["checkbox::neutral+unchecked"].getImage();
|
||||
}
|
||||
|
||||
const int texture_w = texture->getSize().Width;
|
||||
@@ -1144,7 +1149,7 @@ void Skin::process3DPane(IGUIElement *element, const core::rect< s32 > &rect, co
|
||||
}
|
||||
else if (widget->m_event_handler != NULL && widget->m_event_handler->m_type == WTYPE_SPINNER)
|
||||
{
|
||||
drawSpinnerChild(rect, widget, pressed, focused);
|
||||
if (!widget->m_event_handler->m_deactivated) drawSpinnerChild(rect, widget, pressed, focused);
|
||||
}
|
||||
else if (type == WTYPE_ICON_BUTTON || type == WTYPE_MODEL_VIEW)
|
||||
{
|
||||
|
||||
@@ -216,7 +216,8 @@ namespace GUIEngine
|
||||
irr::video::ITexture* bg_image;
|
||||
|
||||
|
||||
void drawBoxFromStretchableTexture(SkinWidgetContainer* w, const irr::core::rect< irr::s32 > &dest, BoxRenderParams& params);
|
||||
void drawBoxFromStretchableTexture(SkinWidgetContainer* w, const irr::core::rect< irr::s32 > &dest,
|
||||
BoxRenderParams& params, bool deactivated=false);
|
||||
|
||||
// my utility methods, to work around irrlicht's very Windows-95-like-look-enforcing skin system
|
||||
void process3DPane(irr::gui::IGUIElement *element, const irr::core::rect< irr::s32 > &rect, const bool pressed);
|
||||
|
||||
@@ -86,8 +86,8 @@ Widget::Widget(bool reserve_id)
|
||||
}
|
||||
|
||||
m_reserved_id = -1;
|
||||
|
||||
m_badges = 0;
|
||||
m_deactivated = false;
|
||||
m_badges = 0;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace GUIEngine
|
||||
* Each widget may have an irrlicht parent (most often used to put widgets in dialogs)
|
||||
* and also optionally one or many children.
|
||||
*
|
||||
* Each widget also has a set of properties stored in a ma (see enum above)
|
||||
* Each widget also has a set of properties stored in a map (see enum above)
|
||||
*/
|
||||
class Widget : public SkinWidgetContainer
|
||||
{
|
||||
@@ -127,14 +127,15 @@ namespace GUIEngine
|
||||
* the event propagate to the user's event handler.
|
||||
*/
|
||||
virtual EventPropagation rightPressed(const int playerID) { return EVENT_BLOCK; }
|
||||
virtual EventPropagation leftPressed(const int playerID) { return EVENT_BLOCK; }
|
||||
virtual EventPropagation leftPressed (const int playerID) { return EVENT_BLOCK; }
|
||||
|
||||
/** used when you set eventSupervisors - see m_event_handler explainations below
|
||||
called when one of a widget's children is hovered.
|
||||
Returns 'true' if main event handler should be notified of a change. */
|
||||
\return 'EVENT_LET' if main event handler should be notified of a change, 'EVENT_BLOCK' otherwise */
|
||||
virtual EventPropagation mouseHovered(Widget* child, const int playerID) { return EVENT_BLOCK; }
|
||||
|
||||
/** override in children if you need to know when the widget is focused. return whether to block event */
|
||||
/** override in children if you need to know when the widget is focused.
|
||||
* \return whether to block event */
|
||||
virtual EventPropagation focused(const int playerID) { setWithinATextBox(false); return EVENT_LET; }
|
||||
|
||||
/** override in children if you need to know when the widget is unfocused. */
|
||||
@@ -228,6 +229,9 @@ namespace GUIEngine
|
||||
it instead of creating a new ID if it is. In practice, it's not widely implemented (FIXME) */
|
||||
int m_reserved_id;
|
||||
|
||||
/** A simple flag that can be raised to hide this widget */
|
||||
bool m_deactivated;
|
||||
|
||||
Widget(bool reserve_id = false);
|
||||
virtual ~Widget();
|
||||
|
||||
|
||||
@@ -241,6 +241,9 @@ namespace GUIEngine
|
||||
/** callback from IRibbonListener */
|
||||
virtual void onRibbonWidgetFocus(RibbonWidget* emitter, const int playerID);
|
||||
|
||||
/** callback from IRibbonListener */
|
||||
virtual void onSelectionChange(){}
|
||||
|
||||
virtual void update(float delta);
|
||||
};
|
||||
|
||||
|
||||
@@ -41,11 +41,12 @@ RibbonWidget::RibbonWidget(const RibbonType type)
|
||||
}
|
||||
m_selection[0] = 0; // only player 0 has a selection by default
|
||||
|
||||
m_type = WTYPE_RIBBON;
|
||||
m_ribbon_type = type;
|
||||
m_mouse_focus = NULL;
|
||||
updateSelection();
|
||||
m_type = WTYPE_RIBBON;
|
||||
m_listener = NULL;
|
||||
|
||||
updateSelection();
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
void RibbonWidget::add()
|
||||
@@ -410,6 +411,8 @@ void RibbonWidget::updateSelection()
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if (m_listener) m_listener->onSelectionChange();
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
EventPropagation RibbonWidget::transmitEvent(Widget* w, std::string& originator, const int playerID)
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace GUIEngine
|
||||
virtual ~IRibbonListener(){}
|
||||
virtual void onRibbonWidgetScroll(const int delta_x) = 0;
|
||||
virtual void onRibbonWidgetFocus(RibbonWidget* emitter, const int playerID) = 0;
|
||||
virtual void onSelectionChange() = 0;
|
||||
};
|
||||
|
||||
private:
|
||||
@@ -85,7 +86,8 @@ namespace GUIEngine
|
||||
void add();
|
||||
|
||||
/** Sets a listener that will be notified of changes on this ribbon.
|
||||
* Does _not_ take ownership of the listener, i.e. will not delete it. */
|
||||
* Does _not_ take ownership of the listener, i.e. will not delete it.
|
||||
* You may call this with the listener parameter set to NULL to remove the listener. */
|
||||
void setListener(IRibbonListener* listener) { m_listener = listener; }
|
||||
|
||||
/** Returns the type of this ribbon (see guiengine/engine.hpp for detailed descriptions) */
|
||||
|
||||
@@ -29,12 +29,15 @@ using namespace irr::gui;
|
||||
using namespace irr::video;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
SpinnerWidget::SpinnerWidget(const bool gauge)
|
||||
{
|
||||
m_gauge = gauge;
|
||||
m_type = WTYPE_SPINNER;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void SpinnerWidget::add()
|
||||
{
|
||||
// retrieve min and max values
|
||||
@@ -155,7 +158,9 @@ ITexture* SpinnerWidget::getTexture()
|
||||
ITexture* texture = irr_driver->getTexture(imagefile);
|
||||
return texture;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void SpinnerWidget::move(const int x, const int y, const int w, const int h)
|
||||
{
|
||||
Widget::move(x, y, w, h);
|
||||
@@ -185,8 +190,12 @@ void SpinnerWidget::move(const int x, const int y, const int w, const int h)
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
EventPropagation SpinnerWidget::rightPressed(const int playerID)
|
||||
{
|
||||
// if widget is deactivated, do nothing
|
||||
if (m_deactivated) return EVENT_BLOCK;
|
||||
|
||||
//std::cout << "Right pressed\n";
|
||||
if (m_value+1 <= m_max) setValue(m_value+1);
|
||||
|
||||
@@ -194,9 +203,14 @@ EventPropagation SpinnerWidget::rightPressed(const int playerID)
|
||||
|
||||
return EVENT_LET;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
EventPropagation SpinnerWidget::leftPressed(const int playerID)
|
||||
{
|
||||
// if widget is deactivated, do nothing
|
||||
if (m_deactivated) return EVENT_BLOCK;
|
||||
|
||||
//std::cout << "Left pressed\n";
|
||||
if (m_value-1 >= m_min) setValue(m_value-1);
|
||||
|
||||
@@ -204,21 +218,30 @@ EventPropagation SpinnerWidget::leftPressed(const int playerID)
|
||||
|
||||
return EVENT_LET;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
EventPropagation SpinnerWidget::transmitEvent(Widget* w, std::string& originator, const int playerID)
|
||||
{
|
||||
if (originator == "left") leftPressed(playerID);
|
||||
// if widget is deactivated, do nothing
|
||||
if (m_deactivated) return EVENT_BLOCK;
|
||||
|
||||
if (originator == "left") leftPressed(playerID);
|
||||
else if (originator == "right") rightPressed(playerID);
|
||||
|
||||
this->setFocusForPlayer( playerID );
|
||||
return EVENT_LET;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void SpinnerWidget::clearLabels()
|
||||
{
|
||||
m_labels.clear();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void SpinnerWidget::addLabel(stringw label)
|
||||
{
|
||||
m_labels.push_back(label);
|
||||
@@ -226,7 +249,9 @@ void SpinnerWidget::addLabel(stringw label)
|
||||
m_max = m_labels.size()-1;
|
||||
setValue(0);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void SpinnerWidget::setValue(const int new_value)
|
||||
{
|
||||
m_value = new_value;
|
||||
@@ -253,6 +278,8 @@ void SpinnerWidget::setValue(const int new_value)
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
stringw SpinnerWidget::getStringValue() const
|
||||
{
|
||||
if (m_labels.size() > 0)
|
||||
@@ -271,3 +298,6 @@ stringw SpinnerWidget::getStringValue() const
|
||||
/** To avoid compiler warnings about missing return statements. */
|
||||
return "";
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -31,6 +31,24 @@
|
||||
|
||||
using namespace GUIEngine;
|
||||
|
||||
class GameModeRibbonListener : public DynamicRibbonHoverListener
|
||||
{
|
||||
RaceSetupScreen* m_parent;
|
||||
public:
|
||||
|
||||
GameModeRibbonListener(RaceSetupScreen* parent)
|
||||
{
|
||||
m_parent = parent;
|
||||
}
|
||||
|
||||
virtual void onSelectionChanged(DynamicRibbonWidget* theWidget, const std::string& selectionID,
|
||||
const irr::core::stringw& selectionText, const int playerID)
|
||||
{
|
||||
// game mode changed!!
|
||||
m_parent->onGameModeChanged();
|
||||
}
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
RaceSetupScreen::RaceSetupScreen() : Screen("racesetup.stkgui")
|
||||
@@ -105,6 +123,34 @@ void RaceSetupScreen::eventCallback(Widget* widget, const std::string& name, con
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void RaceSetupScreen::onGameModeChanged()
|
||||
{
|
||||
DynamicRibbonWidget* w2 = getWidget<DynamicRibbonWidget>("gamemode");
|
||||
assert( w2 != NULL );
|
||||
|
||||
//FIXME: don't hardcode player 0?
|
||||
std::string gamemode = w2->getSelectionIDString(0);
|
||||
|
||||
// deactivate the AI karts count widget for modes for which we have no AI
|
||||
//FIXME? Don't hardcode here which modes have an AI and which don't
|
||||
SpinnerWidget* kartamount = getWidget<SpinnerWidget>("aikartamount");
|
||||
kartamount->m_deactivated = (gamemode == "3strikes");
|
||||
|
||||
// use this dirty trick to hide the number inside the spinner (FIXME)
|
||||
if (kartamount->m_deactivated)
|
||||
{
|
||||
kartamount->m_text = L"-";
|
||||
kartamount->setValue( kartamount->getValue() );
|
||||
}
|
||||
else if (kartamount->m_text.size() > 0)
|
||||
{
|
||||
kartamount->m_text = L"";
|
||||
kartamount->setValue( kartamount->getValue() );
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void RaceSetupScreen::init()
|
||||
{
|
||||
RibbonWidget* w = getWidget<RibbonWidget>("difficulty");
|
||||
@@ -157,12 +203,22 @@ void RaceSetupScreen::init()
|
||||
|
||||
|
||||
w2->updateItemDisplay();
|
||||
|
||||
//FIXME: it's unclear to me whether I must add a listener everytime init is called or not
|
||||
m_mode_listener = new GameModeRibbonListener(this);
|
||||
w2->registerHoverListener(m_mode_listener);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void RaceSetupScreen::tearDown()
|
||||
{
|
||||
//delete m_mode_listener;
|
||||
//m_mode_listener = NULL;
|
||||
|
||||
//DynamicRibbonWidget* w2 = getWidget<DynamicRibbonWidget>("gamemode");
|
||||
//assert( w2 != NULL );
|
||||
// w2->setListener(NULL);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@@ -22,12 +22,19 @@
|
||||
|
||||
namespace GUIEngine { class Widget; }
|
||||
|
||||
class GameModeRibbonListener;
|
||||
|
||||
class RaceSetupScreen : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<RaceSetupScreen>
|
||||
{
|
||||
friend class GUIEngine::ScreenSingleton<RaceSetupScreen>;
|
||||
|
||||
friend class GameModeRibbonListener;
|
||||
|
||||
RaceSetupScreen();
|
||||
|
||||
GameModeRibbonListener* m_mode_listener;
|
||||
|
||||
void onGameModeChanged();
|
||||
|
||||
public:
|
||||
void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID);
|
||||
void init();
|
||||
|
||||
Reference in New Issue
Block a user