commit 91c94af
neauoire
·
2022-03-27 21:29:46 +0000 UTC
parent c58fecb
Added Controller/key
2 files changed,
+4,
-0
+0,
-0
+4,
-0
1@@ -1,6 +1,7 @@
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <X11/Xlib.h>
5+#include <X11/Xutil.h>
6
7 #include "uxn.h"
8 #include "devices/system.h"
9@@ -115,6 +116,7 @@ processEvent(void)
10 } break;
11 case KeyPress: {
12 XKeyPressedEvent *e = (XKeyPressedEvent *)&ev;
13+ char buf[7];
14 if(e->keycode == XKeysymToKeycode(display, XK_Escape)) exit(0);
15 if(e->keycode == XKeysymToKeycode(display, XK_Up)) controller_down(devctrl, 0x10);
16 if(e->keycode == XKeysymToKeycode(display, XK_Down)) controller_down(devctrl, 0x20);
17@@ -124,6 +126,8 @@ processEvent(void)
18 if(e->keycode == XKeysymToKeycode(display, XK_Alt)) controller_down(devctrl, 0x02);
19 if(e->keycode == XKeysymToKeycode(display, XK_Shift)) controller_down(devctrl, 0x04);
20 if(e->keycode == XKeysymToKeycode(display, XK_Home)) controller_down(devctrl, 0x08);
21+ XLookupString(e, buf, 7, NULL, NULL);
22+ controller_key(devctrl, buf[0]);
23 } break;
24 case KeyRelease: {
25 XKeyPressedEvent *e = (XKeyPressedEvent *)&ev;