aboutsummaryrefslogtreecommitdiff
path: root/mkb/mkb.h
diff options
context:
space:
mode:
authorjacopo grandi <jak.sk8@hotmail.it>2021-02-18 14:14:23 +0100
committerjacopo grandi <jak.sk8@hotmail.it>2021-02-18 14:14:23 +0100
commit5f0fce4191309e9526b7109a0d87c092ce6a4193 (patch)
tree105257f876551814aa74a0760ec116bd1bf307a5 /mkb/mkb.h
parentead78d51e662057467b79d3a65b20c4ba83cbf07 (diff)
main
Diffstat (limited to 'mkb/mkb.h')
-rw-r--r--mkb/mkb.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/mkb/mkb.h b/mkb/mkb.h
new file mode 100644
index 0000000..74b1a47
--- /dev/null
+++ b/mkb/mkb.h
@@ -0,0 +1,24 @@
+#ifndef MKB_H
+#define MKB_H
+
+#include <SDL.h>
+
+// SDL2 mouse and keyboard
+
+typedef struct {
+ SDL_Scancode kb[128]; /* keyboard state, reset every frame */
+ int kbnum;
+ int mx; /* mouse x pos */
+ int my; /* mouse y pos */
+ int mclick[3];
+ int mheld[3];
+ int mwheeldelta;
+} MKb;
+
+void mkb_init(MKb *mkb);
+bool mkb_search(MKb *mkb, SDL_Scancode scancode);
+bool mkb_statesearch(MKb *mkb, SDL_Scancode scancode);
+void mkb_event(MKb *mkb, SDL_Event *e);
+void mkb_process(MKb *mkb);
+
+#endif \ No newline at end of file