From 5692e47739f6cabc3b090d324b51022e1b46ddc8 Mon Sep 17 00:00:00 2001 From: Deve Date: Sun, 7 Sep 2014 22:52:45 +0200 Subject: [PATCH] Set selection to "start" by default in track info screen. Don't start the race using left or right arrow. --- src/states_screens/track_info_screen.cpp | 37 ++++++++++++++++++++++++ src/states_screens/track_info_screen.hpp | 8 +++++ 2 files changed, 45 insertions(+) diff --git a/src/states_screens/track_info_screen.cpp b/src/states_screens/track_info_screen.cpp index 0e8914283..de3852755 100644 --- a/src/states_screens/track_info_screen.cpp +++ b/src/states_screens/track_info_screen.cpp @@ -193,6 +193,9 @@ void TrackInfoScreen::init() getWidget("highscore2")->setVisible(false); getWidget("highscore3")->setVisible(false); } + + RibbonWidget* bt_start = getWidget("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("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 + +// ----------------------------------------------------------------------------- diff --git a/src/states_screens/track_info_screen.hpp b/src/states_screens/track_info_screen.hpp index 00387bc60..ee2668ad8 100644 --- a/src/states_screens/track_info_screen.hpp +++ b/src/states_screens/track_info_screen.hpp @@ -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); };