1195 Multiplayer Kart selection screen commit 22

This commit is contained in:
Dk 2014-03-08 21:08:06 +05:30
parent 52e910a438
commit b4d922512e
4 changed files with 16 additions and 20 deletions

View File

@ -1222,30 +1222,28 @@ void Skin::drawSpinnerBody(const core::recti &rect, Widget* widget,
} }
} }
BoxRenderParams params; BoxRenderParams* params;
// defining a spinner widget to use the spinner widget class property(getBackgroundColor)
SpinnerWidget* q = dynamic_cast<SpinnerWidget*>(widget); SpinnerWidget* q = dynamic_cast<SpinnerWidget*>(widget);
if(q->getUseBackgroundColor()) if(q->getUseBackgroundColor())
{ {
int player_id=q->getSpinnerWidgetPlayerID(); int player_id=q->getSpinnerWidgetPlayerID();
if(player_id==0) if(player_id==0)
params=SkinConfig::m_render_params["spinner1::neutral"]; params=&SkinConfig::m_render_params["spinner1::neutral"];
else if(player_id==1) else if(player_id==1)
params=SkinConfig::m_render_params["spinner2::neutral"]; params=&SkinConfig::m_render_params["spinner2::neutral"];
else if(player_id==2) else if(player_id==2)
params=SkinConfig::m_render_params["spinner3::neutral"]; params=&SkinConfig::m_render_params["spinner3::neutral"];
else if(player_id==3) else if(player_id==3)
params=SkinConfig::m_render_params["spinner4::neutral"]; params=&SkinConfig::m_render_params["spinner4::neutral"];
} }
else if (focused|| pressed) else if (focused|| pressed)
{ {
params=SkinConfig::m_render_params["spinner::focused"]; params=&SkinConfig::m_render_params["spinner::focused"];
} }
else else
{ {
params=SkinConfig::m_render_params["spinner::neutral"]; params=&SkinConfig::m_render_params["spinner::neutral"];
} }
if (widget->isFocusedForPlayer(0)) if (widget->isFocusedForPlayer(0))
{ {
core::recti rect2 = rect; core::recti rect2 = rect;
@ -1310,7 +1308,7 @@ void Skin::drawSpinnerBody(const core::recti &rect, Widget* widget,
- (int)center.Y)*texture_size); - (int)center.Y)*texture_size);
} }
drawBoxFromStretchableTexture(widget, sized_rect, params, drawBoxFromStretchableTexture(widget, sized_rect, *params,
widget->m_deactivated); widget->m_deactivated);
@ -1319,8 +1317,8 @@ void Skin::drawSpinnerBody(const core::recti &rect, Widget* widget,
if (w->isGauge() && !w->m_deactivated) if (w->isGauge() && !w->m_deactivated)
{ {
const int handle_size = (int)( widget->m_h*params.m_left_border const int handle_size = (int)( widget->m_h*params->m_left_border
/(float)params.getImage()->getSize().Height ); /(float)params->getImage()->getSize().Height );
const float value = (float)(w->getValue() - w->getMin()) const float value = (float)(w->getValue() - w->getMin())
/ (w->getMax() - w->getMin()); / (w->getMax() - w->getMin());

View File

@ -57,6 +57,9 @@ namespace GUIEngine
int m_value, m_min, m_max; int m_value, m_min, m_max;
int m_spinner_widget_player_id;
bool m_use_background_color;
/** If each value the spinner can take has an associated text, this vector will be non-empty */ /** If each value the spinner can take has an associated text, this vector will be non-empty */
std::vector<irr::core::stringw> m_labels; std::vector<irr::core::stringw> m_labels;
@ -96,8 +99,7 @@ namespace GUIEngine
irr::video::ITexture* getTexture(); irr::video::ITexture* getTexture();
public: public:
int m_spinner_widget_player_id;
bool m_use_background_color;
LEAK_CHECK() LEAK_CHECK()
SpinnerWidget(const bool gauge=false); SpinnerWidget(const bool gauge=false);

View File

@ -141,6 +141,7 @@ PlayerNameSpinner::PlayerNameSpinner(KartSelectionScreen* parent,
void PlayerNameSpinner::setID(const int m_player_id) void PlayerNameSpinner::setID(const int m_player_id)
{ {
PlayerNameSpinner::m_player_id = m_player_id; PlayerNameSpinner::m_player_id = m_player_id;
setSpinnerWidgetPlayerID(m_player_id);
} // setID } // setID
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
/** Add a red mark on the spinner to mean "invalid choice" */ /** Add a red mark on the spinner to mean "invalid choice" */
@ -176,11 +177,6 @@ void PlayerNameSpinner::markAsCorrect()
m_incorrect = false; m_incorrect = false;
} }
} // markAsCorrect } // markAsCorrect
PlayerNameSpinner::~PlayerNameSpinner()
{
unsetUseBackgroundColor();
}
// ============================================================================ // ============================================================================
#if 0 #if 0
@ -416,6 +412,7 @@ void PlayerKartWidget::setPlayerID(const int newPlayerID)
// Change the player ID // Change the player ID
m_player_id = newPlayerID; m_player_id = newPlayerID;
m_player_ident_spinner->setID(m_player_id);
// restore previous focus, but with new player ID // restore previous focus, but with new player ID
if (focus != NULL) focus->setFocusForPlayer(m_player_id); if (focus != NULL) focus->setFocusForPlayer(m_player_id);

View File

@ -213,7 +213,6 @@ public:
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
/** Add a red mark on the spinner to mean "invalid choice" */ /** Add a red mark on the spinner to mean "invalid choice" */
void markAsIncorrect(); void markAsIncorrect();
~PlayerNameSpinner();
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
/** Remove any red mark set with 'markAsIncorrect' */ /** Remove any red mark set with 'markAsIncorrect' */