diff options
author | Matthew Hoops | 2011-09-18 15:48:31 -0400 |
---|---|---|
committer | Matthew Hoops | 2011-09-18 15:48:31 -0400 |
commit | 8f6e6030999e7263062461eaf6e0fe378a3892ba (patch) | |
tree | c057fd4ad7f7b1e027c0548bdd12a17b5a368949 /engines/pegasus/input.cpp | |
parent | 1390db1df12a8a853deca62df2e11a899c111fcf (diff) | |
download | scummvm-rg350-8f6e6030999e7263062461eaf6e0fe378a3892ba.tar.gz scummvm-rg350-8f6e6030999e7263062461eaf6e0fe378a3892ba.tar.bz2 scummvm-rg350-8f6e6030999e7263062461eaf6e0fe378a3892ba.zip |
PEGASUS: Add the Tracker class
Diffstat (limited to 'engines/pegasus/input.cpp')
-rwxr-xr-x | engines/pegasus/input.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/engines/pegasus/input.cpp b/engines/pegasus/input.cpp index 37f9945634..9ef369eb60 100755 --- a/engines/pegasus/input.cpp +++ b/engines/pegasus/input.cpp @@ -267,4 +267,31 @@ bool InputHandler::wantsCursor() { return false; } +Tracker *Tracker::_currentTracker = 0; + +void Tracker::handleInput(const Input &input, const Hotspot *) { + if (stopTrackingInput(input)) + stopTracking(input); + else if (isTracking()) + continueTracking(input); +} + +void Tracker::startTracking(const Input &) { + if (!isTracking()) { + _savedHandler = InputHandler::setInputHandler(this); + _currentTracker = this; + } +} + +void Tracker::stopTracking(const Input &) { + if (isTracking()) { + _currentTracker = NULL; + InputHandler::setInputHandler(_savedHandler); + } +} + +bool Tracker::isClickInput(const Input &input, const Hotspot *hotspot) { + return !isTracking() && InputHandler::isClickInput(input, hotspot); +} + } // End of namespace Pegasus |