[Scummvm-cvs-logs] SF.net SVN: scummvm:[42726] scummvm/trunk/common/events.h

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sat Jul 25 03:00:47 CEST 2009


Revision: 42726
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42726&view=rev
Author:   lordhoto
Date:     2009-07-25 01:00:47 +0000 (Sat, 25 Jul 2009)

Log Message:
-----------
Moved ArtificialEventSource to common/events.h.

Modified Paths:
--------------
    scummvm/trunk/common/events.h

Modified: scummvm/trunk/common/events.h
===================================================================
--- scummvm/trunk/common/events.h	2009-07-25 01:00:37 UTC (rev 42725)
+++ scummvm/trunk/common/events.h	2009-07-25 01:00:47 UTC (rev 42726)
@@ -159,6 +159,36 @@
 };
 
 /**
+ * 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.
  *
  * An example for this is the Engine object, it is catching events and processing them.


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