diff options
author | kdx <kikoodx@paranoici.org> | 2024-04-11 04:02:53 +0200 |
---|---|---|
committer | kdx <kikoodx@paranoici.org> | 2024-04-11 04:02:53 +0200 |
commit | d3c64be44ac87a415fa33bfa17a4635b0c64e549 (patch) | |
tree | 9d63efacd7dd192b171ced2a523d0b1276c08cd1 | |
parent | 48aab2cbf0456fb90a92ddd8819926892acc70b3 (diff) | |
download | input-d3c64be44ac87a415fa33bfa17a4635b0c64e549.tar.gz |
bind tag to TZR_event value
-rw-r--r-- | compile_flags.txt | 1 | ||||
-rw-r--r-- | input.c | 15 | ||||
-rw-r--r-- | input.h | 1 |
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 @@ -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) { @@ -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); |