[Scummvm-cvs-logs] SF.net SVN: scummvm:[42722] scummvm/trunk/backends/events/default
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Sat Jul 25 02:59:53 CEST 2009
Revision: 42722
http://scummvm.svn.sourceforge.net/scummvm/?rev=42722&view=rev
Author: lordhoto
Date: 2009-07-25 00:59:53 +0000 (Sat, 25 Jul 2009)
Log Message:
-----------
Replaced "_artificialEventQueue" by an EventSource.
Modified Paths:
--------------
scummvm/trunk/backends/events/default/default-events.cpp
scummvm/trunk/backends/events/default/default-events.h
Modified: scummvm/trunk/backends/events/default/default-events.cpp
===================================================================
--- scummvm/trunk/backends/events/default/default-events.cpp 2009-07-25 00:59:39 UTC (rev 42721)
+++ scummvm/trunk/backends/events/default/default-events.cpp 2009-07-25 00:59:53 UTC (rev 42722)
@@ -380,8 +380,7 @@
uint32 time = g_system->getMillis();
bool result;
- if (!_artificialEventQueue.empty()) {
- event = _artificialEventQueue.pop();
+ if (_artificialEventSource.pollEvent(event)) {
result = true;
} else {
result = _boss->pollEvent(event);
@@ -599,9 +598,9 @@
// If already received an EVENT_QUIT, don't add another one
if (event.type == Common::EVENT_QUIT) {
if (!_shouldQuit)
- _artificialEventQueue.push(event);
+ _artificialEventSource.addEvent(event);
} else
- _artificialEventQueue.push(event);
+ _artificialEventSource.addEvent(event);
}
#endif // !defined(DISABLE_DEFAULT_EVENTMANAGER)
Modified: scummvm/trunk/backends/events/default/default-events.h
===================================================================
--- scummvm/trunk/backends/events/default/default-events.h 2009-07-25 00:59:39 UTC (rev 42721)
+++ scummvm/trunk/backends/events/default/default-events.h 2009-07-25 00:59:53 UTC (rev 42722)
@@ -53,8 +53,27 @@
bool _remap;
#endif
- Common::Queue<Common::Event> _artificialEventQueue;
+ // TODO: Maybe move this to common/events.h, when other code uses something similar
+ class ArtificialEventSource : public Common::EventSource {
+ private:
+ 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;
+ }
+ }
+
+ bool allowMapping() const { return false; }
+ } _artificialEventSource;
+
Common::Point _mousePos;
int _buttonState;
int _modifierState;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list