Temporarly show focus on spinners for players > 0
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3937 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
8b6bc9d9b5
commit
d3dddc901b
@ -201,6 +201,7 @@ void EventHandler::processAction(const int action, const unsigned int value, Inp
|
|||||||
{
|
{
|
||||||
Widget* w = NULL;
|
Widget* w = NULL;
|
||||||
|
|
||||||
|
// TODO : unify player 0 and players > 0 focus navigation to eliminate this kind of branching
|
||||||
if (playerID == 0)
|
if (playerID == 0)
|
||||||
{
|
{
|
||||||
IGUIElement *el = GUIEngine::getGUIEnv()->getFocus();
|
IGUIElement *el = GUIEngine::getGUIEnv()->getFocus();
|
||||||
@ -237,6 +238,7 @@ void EventHandler::processAction(const int action, const unsigned int value, Inp
|
|||||||
{
|
{
|
||||||
Widget* w = NULL;
|
Widget* w = NULL;
|
||||||
|
|
||||||
|
// TODO : unify player 0 and players > 0 focus navigation to eliminate this kind of branching
|
||||||
if (playerID == 0)
|
if (playerID == 0)
|
||||||
{
|
{
|
||||||
IGUIElement *el = GUIEngine::getGUIEnv()->getFocus();
|
IGUIElement *el = GUIEngine::getGUIEnv()->getFocus();
|
||||||
@ -313,6 +315,7 @@ void EventHandler::navigateUp(const int playerID, Input::InputType type, const b
|
|||||||
{
|
{
|
||||||
IGUIElement *el, *first=NULL, *closest=NULL;
|
IGUIElement *el, *first=NULL, *closest=NULL;
|
||||||
|
|
||||||
|
// TODO : unify player 0 and players > 0 focus navigation to eliminate this kind of branching
|
||||||
if (playerID == 0)
|
if (playerID == 0)
|
||||||
el = GUIEngine::getGUIEnv()->getFocus();
|
el = GUIEngine::getGUIEnv()->getFocus();
|
||||||
else
|
else
|
||||||
@ -393,6 +396,7 @@ void EventHandler::navigateDown(const int playerID, Input::InputType type, const
|
|||||||
{
|
{
|
||||||
IGUIElement *el, *first = NULL, *closest = NULL;
|
IGUIElement *el, *first = NULL, *closest = NULL;
|
||||||
|
|
||||||
|
// TODO : unify player 0 and players > 0 focus navigation to eliminate this kind of branching
|
||||||
if (playerID == 0)
|
if (playerID == 0)
|
||||||
el = GUIEngine::getGUIEnv()->getFocus();
|
el = GUIEngine::getGUIEnv()->getFocus();
|
||||||
else
|
else
|
||||||
|
@ -502,54 +502,71 @@ X##_yflip.LowerRightCorner.Y = w->dest_y + (w->dest_y2 - w->dest_y) - y1;}
|
|||||||
core::rect<s32>& GET_AREA(dest_area_bottom_right);
|
core::rect<s32>& GET_AREA(dest_area_bottom_right);
|
||||||
#undef GET_AREA
|
#undef GET_AREA
|
||||||
|
|
||||||
|
SColor* colorptr = NULL;
|
||||||
|
|
||||||
|
if (w->r != -1 && w->g != -1 && w->b != -1)
|
||||||
|
{
|
||||||
|
SColor thecolor(255, w->r, w->g, w->b);
|
||||||
|
colorptr = new SColor[4]();
|
||||||
|
colorptr[0] = thecolor;
|
||||||
|
colorptr[1] = thecolor;
|
||||||
|
colorptr[2] = thecolor;
|
||||||
|
colorptr[3] = thecolor;
|
||||||
|
}
|
||||||
|
|
||||||
if ((areas & BoxRenderParams::LEFT) != 0)
|
if ((areas & BoxRenderParams::LEFT) != 0)
|
||||||
{
|
{
|
||||||
GUIEngine::getDriver()->draw2DImage(source, dest_area_left, source_area_left,
|
GUIEngine::getDriver()->draw2DImage(source, dest_area_left, source_area_left,
|
||||||
0 /* no clipping */, 0, true /* alpha */);
|
0 /* no clipping */, colorptr, true /* alpha */);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((areas & BoxRenderParams::BODY) != 0)
|
if ((areas & BoxRenderParams::BODY) != 0)
|
||||||
{
|
{
|
||||||
GUIEngine::getDriver()->draw2DImage(source, dest_area_center, source_area_center,
|
GUIEngine::getDriver()->draw2DImage(source, dest_area_center, source_area_center,
|
||||||
0 /* no clipping */, 0, true /* alpha */);
|
0 /* no clipping */, colorptr, true /* alpha */);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((areas & BoxRenderParams::RIGHT) != 0)
|
if ((areas & BoxRenderParams::RIGHT) != 0)
|
||||||
{
|
{
|
||||||
GUIEngine::getDriver()->draw2DImage(source, dest_area_right, source_area_right,
|
GUIEngine::getDriver()->draw2DImage(source, dest_area_right, source_area_right,
|
||||||
0 /* no clipping */, 0, true /* alpha */);
|
0 /* no clipping */, colorptr, true /* alpha */);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((areas & BoxRenderParams::TOP) != 0)
|
if ((areas & BoxRenderParams::TOP) != 0)
|
||||||
{
|
{
|
||||||
GUIEngine::getDriver()->draw2DImage(source, dest_area_top, source_area_top,
|
GUIEngine::getDriver()->draw2DImage(source, dest_area_top, source_area_top,
|
||||||
0 /* no clipping */, 0, true /* alpha */);
|
0 /* no clipping */, colorptr, true /* alpha */);
|
||||||
}
|
}
|
||||||
if ((areas & BoxRenderParams::BOTTOM) != 0)
|
if ((areas & BoxRenderParams::BOTTOM) != 0)
|
||||||
{
|
{
|
||||||
GUIEngine::getDriver()->draw2DImage(source, dest_area_bottom, source_area_bottom,
|
GUIEngine::getDriver()->draw2DImage(source, dest_area_bottom, source_area_bottom,
|
||||||
0 /* no clipping */, 0, true /* alpha */);
|
0 /* no clipping */, colorptr, true /* alpha */);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ((areas & BoxRenderParams::LEFT) != 0) && ((areas & BoxRenderParams::TOP) != 0) )
|
if ( ((areas & BoxRenderParams::LEFT) != 0) && ((areas & BoxRenderParams::TOP) != 0) )
|
||||||
{
|
{
|
||||||
GUIEngine::getDriver()->draw2DImage(source, dest_area_top_left, source_area_top_left,
|
GUIEngine::getDriver()->draw2DImage(source, dest_area_top_left, source_area_top_left,
|
||||||
0 /* no clipping */, 0, true /* alpha */);
|
0 /* no clipping */, colorptr, true /* alpha */);
|
||||||
}
|
}
|
||||||
if ( ((areas & BoxRenderParams::RIGHT) != 0) && ((areas & BoxRenderParams::TOP) != 0) )
|
if ( ((areas & BoxRenderParams::RIGHT) != 0) && ((areas & BoxRenderParams::TOP) != 0) )
|
||||||
{
|
{
|
||||||
GUIEngine::getDriver()->draw2DImage(source, dest_area_top_right, source_area_top_right,
|
GUIEngine::getDriver()->draw2DImage(source, dest_area_top_right, source_area_top_right,
|
||||||
0 /* no clipping */, 0, true /* alpha */);
|
0 /* no clipping */, colorptr, true /* alpha */);
|
||||||
}
|
}
|
||||||
if ( ((areas & BoxRenderParams::LEFT) != 0) && ((areas & BoxRenderParams::BOTTOM) != 0) )
|
if ( ((areas & BoxRenderParams::LEFT) != 0) && ((areas & BoxRenderParams::BOTTOM) != 0) )
|
||||||
{
|
{
|
||||||
GUIEngine::getDriver()->draw2DImage(source, dest_area_bottom_left, source_area_bottom_left,
|
GUIEngine::getDriver()->draw2DImage(source, dest_area_bottom_left, source_area_bottom_left,
|
||||||
0 /* no clipping */, 0, true /* alpha */);
|
0 /* no clipping */, colorptr, true /* alpha */);
|
||||||
}
|
}
|
||||||
if ( ((areas & BoxRenderParams::RIGHT) != 0) && ((areas & BoxRenderParams::BOTTOM) != 0) )
|
if ( ((areas & BoxRenderParams::RIGHT) != 0) && ((areas & BoxRenderParams::BOTTOM) != 0) )
|
||||||
{
|
{
|
||||||
GUIEngine::getDriver()->draw2DImage(source, dest_area_bottom_right, source_area_bottom_right,
|
GUIEngine::getDriver()->draw2DImage(source, dest_area_bottom_right, source_area_bottom_right,
|
||||||
0 /* no clipping */, 0, true /* alpha */);
|
0 /* no clipping */, colorptr, true /* alpha */);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (colorptr != NULL)
|
||||||
|
{
|
||||||
|
delete[] colorptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -767,6 +784,33 @@ void Skin::drawSpinnerBody(const core::rect< s32 > &rect, Widget* widget, const
|
|||||||
|
|
||||||
BoxRenderParams& params = (focused || pressed) ? SkinConfig::m_render_params["spinner::focused"] :
|
BoxRenderParams& params = (focused || pressed) ? SkinConfig::m_render_params["spinner::focused"] :
|
||||||
SkinConfig::m_render_params["spinner::neutral"];
|
SkinConfig::m_render_params["spinner::neutral"];
|
||||||
|
|
||||||
|
// FIXME: temporary only
|
||||||
|
if (widget->isFocusedForPlayer(1))
|
||||||
|
{
|
||||||
|
widget->r = 0;
|
||||||
|
widget->g = 200;
|
||||||
|
widget->b = 255;
|
||||||
|
}
|
||||||
|
else if (widget->isFocusedForPlayer(2))
|
||||||
|
{
|
||||||
|
widget->r = 120;
|
||||||
|
widget->g = 0;
|
||||||
|
widget->b = 120;
|
||||||
|
}
|
||||||
|
else if (widget->isFocusedForPlayer(3))
|
||||||
|
{
|
||||||
|
widget->r = 255;
|
||||||
|
widget->g = 0;
|
||||||
|
widget->b = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
widget->r = -1;
|
||||||
|
widget->g = -1;
|
||||||
|
widget->b = -1;
|
||||||
|
}
|
||||||
|
|
||||||
drawBoxFromStretchableTexture(widget, rect, params);
|
drawBoxFromStretchableTexture(widget, rect, params);
|
||||||
|
|
||||||
const SpinnerWidget* w = dynamic_cast<const SpinnerWidget*>(widget);
|
const SpinnerWidget* w = dynamic_cast<const SpinnerWidget*>(widget);
|
||||||
|
@ -141,6 +141,8 @@ namespace GUIEngine
|
|||||||
core::rect<s32> dest_area_bottom_left_yflip;
|
core::rect<s32> dest_area_bottom_left_yflip;
|
||||||
core::rect<s32> dest_area_bottom_right_yflip;
|
core::rect<s32> dest_area_bottom_right_yflip;
|
||||||
|
|
||||||
|
short r, g, b;
|
||||||
|
|
||||||
SkinWidgetContainer()
|
SkinWidgetContainer()
|
||||||
{
|
{
|
||||||
dest_areas_inited = false;
|
dest_areas_inited = false;
|
||||||
@ -149,6 +151,9 @@ namespace GUIEngine
|
|||||||
y = -1;
|
y = -1;
|
||||||
w = -1;
|
w = -1;
|
||||||
h = -1;
|
h = -1;
|
||||||
|
r = -1;
|
||||||
|
g = -1;
|
||||||
|
b = -1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -102,8 +102,6 @@ Widget::Widget(bool reserve_id)
|
|||||||
*/
|
*/
|
||||||
void Widget::setFocusForPlayer(const int playerID)
|
void Widget::setFocusForPlayer(const int playerID)
|
||||||
{
|
{
|
||||||
std::cout << "=========== setFocusForPlayer " << playerID << " : " << m_properties[PROP_ID].c_str() << " =============\n";
|
|
||||||
|
|
||||||
// Unset focus flag on previous widget that had focus
|
// Unset focus flag on previous widget that had focus
|
||||||
if (GUIEngine::g_focus_for_player[playerID] != NULL)
|
if (GUIEngine::g_focus_for_player[playerID] != NULL)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user