From 1dab0daeb53e21e0616f0346fd962100ea6029da Mon Sep 17 00:00:00 2001 From: Dk Date: Wed, 5 Mar 2014 20:16:48 +0530 Subject: [PATCH] 1995 Multiplayer kart selection screen commit 14 --- data/skins/Ocean.stkskin | 1 - data/skins/Peach.stkskin | 1 - src/guiengine/skin.cpp | 48 ++++++++++++------------ src/guiengine/skin.hpp | 3 -- src/guiengine/widgets/spinner_widget.cpp | 21 +---------- src/guiengine/widgets/spinner_widget.hpp | 11 +++--- src/states_screens/kart_selection.cpp | 7 ++-- 7 files changed, 33 insertions(+), 59 deletions(-) diff --git a/data/skins/Ocean.stkskin b/data/skins/Ocean.stkskin index ed10da604..fed16e307 100644 --- a/data/skins/Ocean.stkskin +++ b/data/skins/Ocean.stkskin @@ -148,7 +148,6 @@ when the border that intersect at this corner are enabled. preserve_h_aspect_ratios="true" hborder_out_portion="0.0" /> - - (widget); - BoxRenderParams params; - - if(q->getBackgroundColor()==1) - { + + 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) + SpinnerWidget* q = dynamic_cast(widget); + if(q->getUseBackgroundColor()) + { int player_id=q->getSpinnerWidgetPlayerID(); if(player_id==0) - params=SkinConfig::m_render_params["spinner1::neutral"]; - if(player_id==1) - params=SkinConfig::m_render_params["spinner2::neutral"]; - if(player_id==2) - params=SkinConfig::m_render_params["spinner3::neutral"]; - if(player_id==3) - params=SkinConfig::m_render_params["spinner4::neutral"]; - } - else if (focused|| pressed) - { + params=SkinConfig::m_render_params["spinner1::neutral"]; + else if(player_id==1) + params=SkinConfig::m_render_params["spinner2::neutral"]; + else if(player_id==2) + params=SkinConfig::m_render_params["spinner3::neutral"]; + else if(player_id==3) + params=SkinConfig::m_render_params["spinner4::neutral"]; + } + else if (focused|| pressed) + { params=SkinConfig::m_render_params["spinner::focused"]; - } - else - { + } + else + { params=SkinConfig::m_render_params["spinner::neutral"]; - } + } - if (widget->isFocusedForPlayer(0)) { core::recti rect2 = rect; diff --git a/src/guiengine/skin.hpp b/src/guiengine/skin.hpp index 6d0a77f9a..5392e78df 100644 --- a/src/guiengine/skin.hpp +++ b/src/guiengine/skin.hpp @@ -406,9 +406,6 @@ namespace GUIEngine virtual void setSize (gui::EGUI_DEFAULT_SIZE which, s32 size); virtual void setSpriteBank (gui::IGUISpriteBank *bank); -// BoxRenderParams& setBackground(const core::recti &rect, Widget* widget,BoxRenderParams& params); - - void drawTooltips(); video::ITexture* getImage(const char* name); diff --git a/src/guiengine/widgets/spinner_widget.cpp b/src/guiengine/widgets/spinner_widget.cpp index 2f48f8e14..bb5894939 100644 --- a/src/guiengine/widgets/spinner_widget.cpp +++ b/src/guiengine/widgets/spinner_widget.cpp @@ -47,7 +47,6 @@ SpinnerWidget::SpinnerWidget(const bool gauge) : Widget(WTYPE_SPINNER) m_value = -1; m_use_background_color=false; m_spinner_widget_player_id=-1; - m_min = 0; m_max = 999; } @@ -181,25 +180,7 @@ void SpinnerWidget::add() setValue(m_value); } -void SpinnerWidget::setBackgroundColor() -{ - - m_use_background_color=true; -} -bool SpinnerWidget::getBackgroundColor() -{ - return m_use_background_color; -} -void SpinnerWidget::setSpinnerWidgetPlayerID(int playerID) -{ - - m_spinner_widget_player_id=playerID; - printf("spinnerwidgetplayerid=%d",m_spinner_widget_player_id); -} -int SpinnerWidget::getSpinnerWidgetPlayerID() -{ - return m_spinner_widget_player_id; -} + ITexture* SpinnerWidget::getTexture() { assert(m_graphical); diff --git a/src/guiengine/widgets/spinner_widget.hpp b/src/guiengine/widgets/spinner_widget.hpp index 90785835c..2e3142c4e 100644 --- a/src/guiengine/widgets/spinner_widget.hpp +++ b/src/guiengine/widgets/spinner_widget.hpp @@ -69,7 +69,7 @@ namespace GUIEngine */ bool m_gauge; - //for setting background + //for setting background in multiplayer kart selection screen bool m_use_background_color; int m_spinner_widget_player_id; @@ -109,11 +109,12 @@ namespace GUIEngine void addLabel(irr::core::stringw label); void clearLabels(); + // next four functions are for background colour behind playername in multikart screen selection - void setBackgroundColor(); - bool getBackgroundColor(); - void setSpinnerWidgetPlayerID(int playerID); - int getSpinnerWidgetPlayerID(); + 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;} void setListener(ISpinnerConfirmListener* listener) { m_listener = listener; } diff --git a/src/states_screens/kart_selection.cpp b/src/states_screens/kart_selection.cpp index 45fccc925..d43369c68 100644 --- a/src/states_screens/kart_selection.cpp +++ b/src/states_screens/kart_selection.cpp @@ -132,11 +132,10 @@ PlayerNameSpinner::PlayerNameSpinner(KartSelectionScreen* parent, { m_player_id = player_id; m_incorrect = false; - m_red_mark_widget = NULL; m_parent = parent; m_use_background_color = true; - setBackgroundColor();//already a_use_background_color is false + setUseBackgroundColor();//except for multiplayer kart selection, this is false setSpinnerWidgetPlayerID(m_player_id); } // ------------------------------------------------------------------------ @@ -419,9 +418,9 @@ void PlayerKartWidget::setPlayerID(const int newPlayerID) // restore previous focus, but with new player ID if (focus != NULL) focus->setFocusForPlayer(m_player_id); - if (m_player_ident_spinner != NULL){ + if (m_player_ident_spinner != NULL) + { m_player_ident_spinner->setID(m_player_id); - } } // setPlayerID