Merge pull request #1236 from divvy81/downstream
Change of color player kart when any player quits
This commit is contained in:
commit
112c46fa14
@ -1222,33 +1222,28 @@ void Skin::drawSpinnerBody(const core::recti &rect, Widget* widget,
|
||||
}
|
||||
}
|
||||
|
||||
BoxRenderParams& params = (focused || pressed)
|
||||
? SkinConfig::m_render_params["spinner::focused"]
|
||||
: SkinConfig::m_render_params["spinner::neutral"];
|
||||
|
||||
// defining a spinner widget to use the spinner widget class property(getBackgroundColor)
|
||||
BoxRenderParams* params;
|
||||
SpinnerWidget* q = dynamic_cast<SpinnerWidget*>(widget);
|
||||
if(q->getUseBackgroundColor())
|
||||
{
|
||||
int player_id=q->getSpinnerWidgetPlayerID();
|
||||
if(player_id==0)
|
||||
params=SkinConfig::m_render_params["spinner1::neutral"];
|
||||
params=&SkinConfig::m_render_params["spinner1::neutral"];
|
||||
else if(player_id==1)
|
||||
params=SkinConfig::m_render_params["spinner2::neutral"];
|
||||
params=&SkinConfig::m_render_params["spinner2::neutral"];
|
||||
else if(player_id==2)
|
||||
params=SkinConfig::m_render_params["spinner3::neutral"];
|
||||
params=&SkinConfig::m_render_params["spinner3::neutral"];
|
||||
else if(player_id==3)
|
||||
params=SkinConfig::m_render_params["spinner4::neutral"];
|
||||
params=&SkinConfig::m_render_params["spinner4::neutral"];
|
||||
}
|
||||
else if (focused|| pressed)
|
||||
{
|
||||
params=SkinConfig::m_render_params["spinner::focused"];
|
||||
params=&SkinConfig::m_render_params["spinner::focused"];
|
||||
}
|
||||
else
|
||||
{
|
||||
params=SkinConfig::m_render_params["spinner::neutral"];
|
||||
params=&SkinConfig::m_render_params["spinner::neutral"];
|
||||
}
|
||||
|
||||
if (widget->isFocusedForPlayer(0))
|
||||
{
|
||||
core::recti rect2 = rect;
|
||||
@ -1313,7 +1308,7 @@ void Skin::drawSpinnerBody(const core::recti &rect, Widget* widget,
|
||||
- (int)center.Y)*texture_size);
|
||||
}
|
||||
|
||||
drawBoxFromStretchableTexture(widget, sized_rect, params,
|
||||
drawBoxFromStretchableTexture(widget, sized_rect, *params,
|
||||
widget->m_deactivated);
|
||||
|
||||
|
||||
@ -1322,8 +1317,8 @@ void Skin::drawSpinnerBody(const core::recti &rect, Widget* widget,
|
||||
|
||||
if (w->isGauge() && !w->m_deactivated)
|
||||
{
|
||||
const int handle_size = (int)( widget->m_h*params.m_left_border
|
||||
/(float)params.getImage()->getSize().Height );
|
||||
const int handle_size = (int)( widget->m_h*params->m_left_border
|
||||
/(float)params->getImage()->getSize().Height );
|
||||
const float value = (float)(w->getValue() - w->getMin())
|
||||
/ (w->getMax() - w->getMin());
|
||||
|
||||
|
@ -39,7 +39,6 @@ using namespace irr::video;
|
||||
SpinnerWidget::SpinnerWidget(const bool gauge) : Widget(WTYPE_SPINNER)
|
||||
{
|
||||
m_gauge = gauge;
|
||||
|
||||
m_listener = NULL;
|
||||
m_graphical = false;
|
||||
m_check_inside_me = true; //FIXME: not sure this is necessary
|
||||
|
@ -57,6 +57,9 @@ namespace GUIEngine
|
||||
|
||||
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 */
|
||||
std::vector<irr::core::stringw> m_labels;
|
||||
|
||||
@ -69,10 +72,7 @@ namespace GUIEngine
|
||||
*/
|
||||
bool m_gauge;
|
||||
|
||||
//for setting background
|
||||
bool m_use_background_color;
|
||||
int m_spinner_widget_player_id;
|
||||
|
||||
|
||||
/** \brief Whether to wrap back to the first value when going "beyond" the last value */
|
||||
bool m_wrap_around;
|
||||
|
||||
@ -99,7 +99,7 @@ namespace GUIEngine
|
||||
irr::video::ITexture* getTexture();
|
||||
|
||||
public:
|
||||
|
||||
|
||||
LEAK_CHECK()
|
||||
|
||||
SpinnerWidget(const bool gauge=false);
|
||||
@ -110,10 +110,11 @@ namespace GUIEngine
|
||||
void clearLabels();
|
||||
|
||||
// next four functions are for background colour behind playername in multikart screen selection
|
||||
void setUseBackgroundColor() {m_use_background_color=true;}
|
||||
bool getUseBackgroundColor() {return m_use_background_color;}
|
||||
void setUseBackgroundColor() {m_use_background_color=true; }
|
||||
bool getUseBackgroundColor() {return m_use_background_color; }
|
||||
void setSpinnerWidgetPlayerID(int playerID) {m_spinner_widget_player_id=playerID;}
|
||||
int getSpinnerWidgetPlayerID() {return m_spinner_widget_player_id;}
|
||||
int getSpinnerWidgetPlayerID() {return m_spinner_widget_player_id; }
|
||||
void unsetUseBackgroundColor() {m_use_background_color=false; }
|
||||
|
||||
|
||||
|
||||
|
@ -134,8 +134,6 @@ PlayerNameSpinner::PlayerNameSpinner(KartSelectionScreen* parent,
|
||||
m_incorrect = false;
|
||||
m_red_mark_widget = NULL;
|
||||
m_parent = parent;
|
||||
m_use_background_color = true;
|
||||
|
||||
setUseBackgroundColor();//except for multiplayer kart selection, this is false
|
||||
setSpinnerWidgetPlayerID(m_player_id);
|
||||
} // PlayerNameSpinner
|
||||
@ -143,7 +141,8 @@ PlayerNameSpinner::PlayerNameSpinner(KartSelectionScreen* parent,
|
||||
void PlayerNameSpinner::setID(const int m_player_id)
|
||||
{
|
||||
PlayerNameSpinner::m_player_id = m_player_id;
|
||||
} // setID
|
||||
setSpinnerWidgetPlayerID(m_player_id);
|
||||
} // setID
|
||||
// ------------------------------------------------------------------------
|
||||
/** Add a red mark on the spinner to mean "invalid choice" */
|
||||
void PlayerNameSpinner::markAsIncorrect()
|
||||
@ -178,7 +177,6 @@ void PlayerNameSpinner::markAsCorrect()
|
||||
m_incorrect = false;
|
||||
}
|
||||
} // markAsCorrect
|
||||
|
||||
// ============================================================================
|
||||
|
||||
#if 0
|
||||
@ -382,7 +380,6 @@ PlayerKartWidget::~PlayerKartWidget()
|
||||
|
||||
if (m_kart_name->getIrrlichtElement() != NULL)
|
||||
m_kart_name->getIrrlichtElement()->remove();
|
||||
|
||||
getCurrentScreen()->manualRemoveWidget(this);
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -415,6 +412,7 @@ void PlayerKartWidget::setPlayerID(const int newPlayerID)
|
||||
|
||||
// Change the player ID
|
||||
m_player_id = newPlayerID;
|
||||
m_player_ident_spinner->setID(m_player_id);
|
||||
// restore previous focus, but with new player ID
|
||||
if (focus != NULL) focus->setFocusForPlayer(m_player_id);
|
||||
|
||||
|
@ -220,7 +220,7 @@ public:
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Remove any red mark set with 'markAsIncorrect' */
|
||||
void markAsCorrect();
|
||||
void markAsCorrect();
|
||||
};
|
||||
|
||||
/** A widget representing the kart selection for a player (i.e. the player's
|
||||
|
Loading…
Reference in New Issue
Block a user