shithub: choc

Download patch

ref: 15cbe82d5d62725b6bb2b936be21fad79bb46ce1
parent: ce9d034aa2297b97b632749a2fa6bde56a6fd90a
author: Simon Howard <fraggle@soulsphere.org>
date: Sun Jan 3 11:29:14 EST 2016

event: Refactor doc comments for events.

--- a/src/d_event.h
+++ b/src/d_event.h
@@ -31,39 +31,42 @@
 // Input event types.
 typedef enum
 {
+    // Key press/release events.
+    //    data1: Key code (from doomkeys.h) of the key that was
+    //           pressed or released. This is the key as it appears
+    //           on a US keyboard layout, and does not change with
+    //           layout.
+    //    data2: ASCII version of the character that was pressed.
+    //           Changes with the keyboard layout; eg. if 'Z' is
+    //           pressed on a German keyboard, data1='y',data2='z'.
     ev_keydown,
     ev_keyup,
-    ev_mouse,
-    ev_joystick,
-    ev_quit
-} evtype_t;
 
-// Event structure.
-typedef struct
-{
-    evtype_t type;
-
-    // Event-related data that depends on the type of event:
-    //
-    // ev_keydown/ev_keyup:
-    //    data1: Key code (from doomkeys.h) of the key that was
-    //           pressed or released.
-    //    data2: Ascii text of the character that was pressed,
-    //           shifted appropriately (eg. '$' if 4 was pressed
-    //           while shift was held).
-    //
-    // ev_mouse:
+    // Mouse movement event.
     //    data1: Bitfield of buttons currently held down.
     //           (bit 0 = left; bit 1 = right; bit 2 = middle).
     //    data2: X axis mouse movement (turn).
     //    data3: Y axis mouse movement (forward/backward).
-    //
-    // ev_joystick:
+    ev_mouse,
+
+    // Joystick state.
     //    data1: Bitfield of buttons currently pressed.
     //    data2: X axis mouse movement (turn).
     //    data3: Y axis mouse movement (forward/backward).
     //    data4: Third axis mouse movement (strafe).
+    ev_joystick,
 
+    // Quit event. Triggered when the user clicks the "close" button
+    // to terminate the application.
+    ev_quit
+} evtype_t;
+
+// Event structure.
+typedef struct
+{
+    evtype_t type;
+
+    // Event-specific data; see the descriptions given above.
     int data1, data2, data3, data4;
 } event_t;