diff --git a/source/io/input.c b/source/io/input.c index 73cc854..7332cd3 100644 --- a/source/io/input.c +++ b/source/io/input.c @@ -29,26 +29,30 @@ void InputBufferAdd(struct InputBuffer *buf, struct InputRecord *rec) *buf_get(buf, buf->len++) = *rec; } -void *input_thread_loop(struct InputThreadHandle *hand) +void *input_thread_loop(void *arg) { + struct InputThreadHandle *hand = arg; struct InputBuffer tmp_buf = { .len = 0, .start = 0 }; while (!hand->is_terminating) { + printf("\tinput cycle"); if (!PlatformReadInput(&tmp_buf)) { hand->err = true; - return; + return nullptr; } hand->err = pthread_mutex_lock(&hand->mutex); if (hand->err) - return; + return nullptr; InputBufferTransfer(&tmp_buf, hand->buf); hand->err = pthread_mutex_unlock(&hand->mutex); if (hand->err) - return; + return nullptr; } + + return nullptr; } bool BeginInputThread(struct InputThreadHandle *hand, struct InputBuffer *buf) diff --git a/source/io/platforms/platform.c b/source/io/platforms/platform.c deleted file mode 100644 index e69de29..0000000 diff --git a/source/io/platforms/win.c b/source/io/platforms/win.c index e683185..7b2825f 100644 --- a/source/io/platforms/win.c +++ b/source/io/platforms/win.c @@ -88,7 +88,7 @@ bool copy_mouse_event(struct InputRecord *rec, MOUSE_EVENT_RECORD *win_mouse) return true; } - if (win_mouse->dwEventFlags & (MOUSE_WHEELED | MOUSE_HWHEELED) != 0) { + if ((win_mouse->dwEventFlags & (MOUSE_WHEELED | MOUSE_HWHEELED)) != 0) { rec->type = AXIS; rec->bind = win_mouse->dwEventFlags == MOUSE_WHEELED; rec->axis.value = win_mouse->dwButtonState; diff --git a/source/main.c b/source/main.c index ed8ea7a..d2314cc 100644 --- a/source/main.c +++ b/source/main.c @@ -33,7 +33,17 @@ int main() if (!BeginInputThread(&input, &ctrl.buf)) ErrorExit("Input handle failed to initialize"); - printf("woah"); + CtrlMap(&ctrl, 0, BUTTON, 'A'); + + while (true) { + bool poll = CtrlPoll(&ctrl); + printf("poll: %u\n", poll); + + struct InputAxis *a = CtrlGet(&ctrl, 0, BUTTON); + printf("get: %llu\n", a); + + printf("val: %u\n", a->but.value); + } return 0; } \ No newline at end of file diff --git a/test.exe b/test.exe index 78e8ad2..0f79fc9 100644 Binary files a/test.exe and b/test.exe differ