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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Fri Jun 22 23:32:50 CEST 2007


Revision: 27626
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27626&view=rev
Author:   fingolfin
Date:     2007-06-22 14:32:49 -0700 (Fri, 22 Jun 2007)

Log Message:
-----------
Promoted the struct inside Common::Event which captures the keystate to a full-blown independent struct named KeyState (makes it easier for engines to capture the full keystate, instead of only the keycode or only the ascii/unicode value)

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

Modified: scummvm/trunk/common/events.h
===================================================================
--- scummvm/trunk/common/events.h	2007-06-22 21:16:07 UTC (rev 27625)
+++ scummvm/trunk/common/events.h	2007-06-22 21:32:49 UTC (rev 27626)
@@ -256,6 +256,36 @@
 };
 
 /**
+ * Keyboard status, as used in the Event struct.
+ */
+struct KeyState {
+	/**
+	 * Abstract key code (will be the same for any given key regardless
+	 * of modifiers being held at the same time.
+	 * For example, this is the same for both 'A' and Shift-'A'.
+	 * @todo Document which values are to be used for non-ASCII keys
+	 * like F1-F10. For now, let's just say that our primary backend
+	 * is the SDL one, and it uses the values SDL uses... so until
+	 * we fix this, your best bet is to get a copy of SDL_keysym.h
+	 * and look at that, if you want to find out a key code.
+	 */
+	KeyCode keycode;
+	/**
+	 * ASCII-value of the pressed key (if any).
+	 * This depends on modifiers, i.e. pressing the 'A' key results in
+	 * different values here depending on the status of shift, alt and
+	 * caps lock.
+	 */
+	uint16 ascii;
+	/**
+	 * Status of the modifier keys. Bits are set in this for each
+	 * pressed modifier
+	 * @see KBD_CTRL, KBD_ALT, KBD_SHIFT
+	 */
+	byte flags;
+};
+
+/**
  * Data structure for an event. A pointer to an instance of Event
  * can be passed to pollEvent.
  * @todo Rework/document this structure. It should be made 100% clear which
@@ -294,32 +324,7 @@
 	  * Keyboard data; only valid for keyboard events (EVENT_KEYDOWN and
 	  * EVENT_KEYUP). For all other event types, content is undefined.
 	  */
-	struct {
-		/**
-		 * Abstract key code (will be the same for any given key regardless
-		 * of modifiers being held at the same time.
-		 * For example, this is the same for both 'A' and Shift-'A'.
-		 * @todo Document which values are to be used for non-ASCII keys
-		 * like F1-F10. For now, let's just say that our primary backend
-		 * is the SDL one, and it uses the values SDL uses... so until
-		 * we fix this, your best bet is to get a copy of SDL_keysym.h
-		 * and look at that, if you want to find out a key code.
-		 */
-		KeyCode keycode;
-		/**
-		 * ASCII-value of the pressed key (if any).
-		 * This depends on modifiers, i.e. pressing the 'A' key results in
-		 * different values here depending on the status of shift, alt and
-		 * caps lock.
-		 */
-		uint16 ascii;
-		/**
-		 * Status of the modifier keys. Bits are set in this for each
-		 * pressed modifier
-		 * @see KBD_CTRL, KBD_ALT, KBD_SHIFT
-		 */
-		byte flags;
-	} kbd;
+	KeyState kbd;
 	/**
 	 * The mouse coordinates, in virtual screen coordinates. Only valid
 	 * for mouse events.


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