Set selection to "start" by default in track info screen.

Don't start the race using left or right arrow.
This commit is contained in:
Deve 2014-09-07 22:52:45 +02:00
parent 9116431792
commit 5692e47739
2 changed files with 45 additions and 0 deletions

View File

@ -193,6 +193,9 @@ void TrackInfoScreen::init()
getWidget<LabelWidget>("highscore2")->setVisible(false);
getWidget<LabelWidget>("highscore3")->setVisible(false);
}
RibbonWidget* bt_start = getWidget<GUIEngine::RibbonWidget>("buttons");
bt_start->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
} // init
@ -325,3 +328,37 @@ void TrackInfoScreen::eventCallback(Widget* widget, const std::string& name,
} // eventCallback
// ----------------------------------------------------------------------------
GUIEngine::EventPropagation TrackInfoScreen::filterActions(PlayerAction action,
int deviceID,
const unsigned int value,
Input::InputType type,
int playerId)
{
GUIEngine::EventPropagation result = EVENT_LET;
RibbonWidget* bt_start = getWidget<GUIEngine::RibbonWidget>("buttons");
switch (action)
{
case PA_MENU_LEFT:
case PA_MENU_RIGHT:
{
if (bt_start->isFocusedForPlayer(playerId))
{
result = EVENT_BLOCK;
}
break;
}
case PA_MENU_UP:
case PA_MENU_DOWN:
case PA_MENU_SELECT:
case PA_MENU_CANCEL:
break;
default:
break;
}
return result;
} // filterActions
// -----------------------------------------------------------------------------

View File

@ -74,6 +74,14 @@ public:
virtual void loadedFromFile();
virtual void eventCallback(GUIEngine::Widget *,const std::string &name ,
const int player_id);
/** \brief implement callback from parent class GUIEngine::Screen */
virtual GUIEngine::EventPropagation filterActions( PlayerAction action,
int deviceID,
const unsigned int value,
Input::InputType type,
int playerId) OVERRIDE;
void onEnterPressedInternal();
void setTrack(Track *track);
};