Added way for GUI screens to receive all player actions

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5779 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2010-08-26 00:08:10 +00:00
parent f2080fcab4
commit 8df52854fe
2 changed files with 21 additions and 2 deletions

View File

@ -95,9 +95,19 @@ bool EventHandler::OnEvent (const SEvent &event)
// -----------------------------------------------------------------------------
void EventHandler::processGUIAction(const PlayerAction action, const unsigned int value,
Input::InputType type, const int playerID)
void EventHandler::processGUIAction(const PlayerAction action,
const unsigned int value,
Input::InputType type,
const int playerID)
{
Screen* screen = GUIEngine::getCurrentScreen();
if (screen != NULL)
{
EventPropagation propg = screen->filterActions(action, value,
type, playerID);
if (propg == EVENT_BLOCK) return;
}
const bool pressedDown = value > Input::MAX_VALUE*2/3;
if (!pressedDown && type == Input::IT_STICKMOTION) return;

View File

@ -28,6 +28,7 @@
#include "config/stk_config.hpp"
#include "guiengine/abstract_top_level_container.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/event_handler.hpp"
#include "guiengine/layout_manager.hpp"
#include "guiengine/widget.hpp"
#include "input/input.hpp"
@ -254,10 +255,18 @@ namespace GUIEngine
* \brief Implementing method from AbstractTopLevelContainer
*/
virtual int getWidth();
/**
* \brief Implementing method from AbstractTopLevelContainer
*/
virtual int getHeight();
/**
* \brief override this if you need to be notified of player actions in subclasses
*/
virtual EventPropagation filterActions(PlayerAction action, const unsigned int value,
Input::InputType type, int playerId) { return EVENT_LET; }
};
}