mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-24 21:21:05 +00:00
Moved ArtificialEventSource to common/events.h.
svn-id: r42726
This commit is contained in:
parent
141ded3063
commit
eeaafdf4ee
@ -158,6 +158,36 @@ public:
|
||||
virtual bool allowMapping() const { return true; }
|
||||
};
|
||||
|
||||
/**
|
||||
* An artificial event source. This is class is used as an event source, which is
|
||||
* made up by client specific events.
|
||||
*
|
||||
* Example usage cases for this are the Keymapper or the DefaultEventManager.
|
||||
*/
|
||||
class ArtificialEventSource : public EventSource {
|
||||
protected:
|
||||
Common::Queue<Common::Event> _artificialEventQueue;
|
||||
public:
|
||||
void addEvent(const Common::Event &ev) {
|
||||
_artificialEventQueue.push(ev);
|
||||
}
|
||||
|
||||
bool pollEvent(Common::Event &ev) {
|
||||
if (!_artificialEventQueue.empty()) {
|
||||
ev = _artificialEventQueue.pop();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* By default an artificial event source prevents its events
|
||||
* from being mapped.
|
||||
*/
|
||||
virtual bool allowMapping() const { return false; }
|
||||
};
|
||||
|
||||
/**
|
||||
* Object which catches and processes Events.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user