aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkdx <kikoodx@paranoici.org>2024-04-11 04:02:53 +0200
committerkdx <kikoodx@paranoici.org>2024-04-11 04:02:53 +0200
commitd3c64be44ac87a415fa33bfa17a4635b0c64e549 (patch)
tree9d63efacd7dd192b171ced2a523d0b1276c08cd1
parent48aab2cbf0456fb90a92ddd8819926892acc70b3 (diff)
downloadinput-d3c64be44ac87a415fa33bfa17a4635b0c64e549.tar.gz
bind tag to TZR_event value
-rw-r--r--compile_flags.txt1
-rw-r--r--input.c15
-rw-r--r--input.h1
3 files changed, 17 insertions, 0 deletions
diff --git a/compile_flags.txt b/compile_flags.txt
new file mode 100644
index 0000000..dfee0ce
--- /dev/null
+++ b/compile_flags.txt
@@ -0,0 +1 @@
+-iquote../tzr
diff --git a/input.c b/input.c
index c396180..c75e858 100644
--- a/input.c
+++ b/input.c
@@ -128,6 +128,21 @@ input_bind_action_mb(const char *tag, uint8_t mb)
bind->mb = mb;
}
+void
+input_bind_action_tzr(const char *tag, TZR_Event e)
+{
+ switch (e.type) {
+ case TZR_EV_KEYDOWN:
+ return input_bind_action_sc(tag, e.button);
+ case TZR_EV_MOUSEDOWN:
+ return input_bind_action_mb(tag, e.button);
+ case TZR_EV_GAMECONTROLLERDOWN:
+ return input_bind_action_cb(tag, e.button);
+ default:
+ break;
+ }
+}
+
bool
input_down(const char *tag)
{
diff --git a/input.h b/input.h
index f7f0239..8b2296b 100644
--- a/input.h
+++ b/input.h
@@ -59,6 +59,7 @@ void input_new_axis(const char *tag);
void input_bind_action_sc(const char *tag, SDL_Scancode sc);
void input_bind_action_cb(const char *tag, uint8_t cb);
void input_bind_action_mb(const char *tag, uint8_t mb);
+void input_bind_action_tzr(const char *tag, TZR_Event e);
void input_bind_axis_gc(const char *tag, SDL_GameControllerAxis ax);
void input_bind_axis_act(const char *tag, const char *l, const char *r);