]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
added JOY_UP/DOWN/LEFT/RIGHT keys which are a more general form of the joy_axiskeyeve...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 19 May 2011 01:33:42 +0000 (01:33 +0000)
committerRudolf Polzer <divVerent@xonotic.org>
Mon, 23 May 2011 11:33:06 +0000 (13:33 +0200)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11157 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=db717d093453e95a1fc005d7c884b12562d7ca9f

keys.c
keys.h
vid_shared.c

diff --git a/keys.c b/keys.c
index c955570ce6a3fdb55e149c050b74c03483152bfa..ea6e2d5985c397392f77eb1563806ad25adde2b2 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -498,6 +498,11 @@ static const keyname_t   keynames[] = {
        {"X360_RIGHT_THUMB_LEFT", K_X360_RIGHT_THUMB_LEFT},
        {"X360_RIGHT_THUMB_RIGHT", K_X360_RIGHT_THUMB_RIGHT},
 
+       {"JOY_UP", K_JOY_UP},
+       {"JOY_DOWN", K_JOY_DOWN},
+       {"JOY_LEFT", K_JOY_LEFT},
+       {"JOY_RIGHT", K_JOY_RIGHT},
+
        {"SEMICOLON", ';'},                     // because a raw semicolon separates commands
        {"TILDE", '~'},
        {"BACKQUOTE", '`'},
diff --git a/keys.h b/keys.h
index a02acf2ff993061f5f9230cd092d9d5464d8ddc8..c2587aed1b3a0796f25535a1d359982386759c06 100644 (file)
--- a/keys.h
+++ b/keys.h
@@ -214,6 +214,12 @@ typedef enum keynum_e
        K_X360_RIGHT_THUMB_LEFT,
        K_X360_RIGHT_THUMB_RIGHT,
 
+       // generic joystick emulation for menu
+       K_JOY_UP,
+       K_JOY_DOWN,
+       K_JOY_LEFT,
+       K_JOY_RIGHT,
+
        K_MIDINOTE0 = 896, // to this, the note number is added
        K_MIDINOTE1,
        K_MIDINOTE2,
index 24a1509425533143776b4f3ca0a18910be82c375..ada1a2606baa823f7b577698cae154696a311199 100644 (file)
@@ -1193,7 +1193,7 @@ void VID_Shared_BuildJoyState_Begin(vid_joystate_t *joystate)
 void VID_Shared_BuildJoyState_Finish(vid_joystate_t *joystate)
 {
        float f, r;
-       if (!joy_axiskeyevents.integer || joystate->is360)
+       if (joystate->is360)
                return;
        // emulate key events for thumbstick
        f = VID_JoyState_GetAxis(joystate, joy_axisforward.integer, 1, joy_axiskeyevents_deadzone.value) * joy_sensitivityforward.value;
@@ -1242,7 +1242,7 @@ static int joybuttonkey[MAXJOYBUTTON][2] =
 {
        {K_JOY1, K_ENTER}, {K_JOY2, K_ESCAPE}, {K_JOY3, 0}, {K_JOY4, 0}, {K_JOY5, 0}, {K_JOY6, 0}, {K_JOY7, 0}, {K_JOY8, 0}, {K_JOY9, 0}, {K_JOY10, 0}, {K_JOY11, 0}, {K_JOY12, 0}, {K_JOY13, 0}, {K_JOY14, 0}, {K_JOY15, 0}, {K_JOY16, 0},
        {K_AUX1, 0}, {K_AUX2, 0}, {K_AUX3, 0}, {K_AUX4, 0}, {K_AUX5, 0}, {K_AUX6, 0}, {K_AUX7, 0}, {K_AUX8, 0}, {K_AUX9, 0}, {K_AUX10, 0}, {K_AUX11, 0}, {K_AUX12, 0}, {K_AUX13, 0}, {K_AUX14, 0}, {K_AUX15, 0}, {K_AUX16, 0},
-       {K_UPARROW, K_UPARROW}, {K_DOWNARROW, K_DOWNARROW}, {K_RIGHTARROW, K_RIGHTARROW}, {K_LEFTARROW, K_LEFTARROW},
+       {K_JOY_UP, K_UPARROW}, {K_JOY_DOWN, K_DOWNARROW}, {K_JOY_RIGHT, K_RIGHTARROW}, {K_JOY_LEFT, K_LEFTARROW},
 };
 
 static int joybuttonkey360[][2] =