From 5e23db78ce257b42ca2f9c901ba34440658aa855 Mon Sep 17 00:00:00 2001 From: Julia <145168563+julia-aph@users.noreply.github.com> Date: Tue, 23 Apr 2024 01:35:19 -0500 Subject: [PATCH] kj h --- source/io/ctrl.c | 11 ++++++++++- source/io/ctrl.h | 10 ++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/source/io/ctrl.c b/source/io/ctrl.c index cea9ca6..0b8d337 100644 --- a/source/io/ctrl.c +++ b/source/io/ctrl.c @@ -144,6 +144,10 @@ void dispatch_update(struct InputAxis *axis, struct InputRecord *rec) axis->data = rec->data; } +bool is_alphanumeric(char c) { + return c >=32 and c <= 126; +} + bool read_input_buf(struct Controller *ctrl) { for (size_t i = 0; i < ctrl->pending_buf.len; i++) { @@ -153,7 +157,7 @@ bool read_input_buf(struct Controller *ctrl) axis->is_down = false; } ctrl->pending_buf.len = 0; - + for (size_t i = 0; i < ctrl->buf.len; i++) { struct InputRecord *rec = &ctrl->buf.recs[i]; @@ -187,6 +191,11 @@ bool CtrlPoll(struct Controller *ctrl, struct InputThreadHandle *hand) return true; } +bool CtrlInputString(struct Controller *ctrl, size_t n, char *buf) +{ + +} + /*int main() { struct Controller ctrl; diff --git a/source/io/ctrl.h b/source/io/ctrl.h index ab6f2e3..539748d 100644 --- a/source/io/ctrl.h +++ b/source/io/ctrl.h @@ -46,17 +46,15 @@ struct ctrl_axis_vec { struct Controller { struct InputBuffer buf; - struct InputAxis *pending_axes[IO_BUF_SIZE]; - char string_input[IO_BUF_SIZE]; - - u8f pending_axes_len; - u8f string_input_len; + struct { + struct InputAxis *axes[IO_BUF_SIZE]; + u8f len; + } pending_buf; struct ctrl_axis_vec axis_vec; struct ctrl_dict codes; struct ctrl_dict binds; }; -size_t a = sizeof(struct Controller); bool CreateCtrl(struct Controller *ctrl);