From 788dde31efb612f510d44c391d9e57494ffeacd7 Mon Sep 17 00:00:00 2001 From: fallenoak Date: Wed, 15 Mar 2023 16:58:55 -0500 Subject: [PATCH] feat(event): split out OsInputGet by platform --- src/event/Input.cpp | 28 ---------------------------- src/event/linux/Input.cpp | 6 ++++++ src/event/mac/Input.cpp | 22 ++++++++++++++++++++++ src/event/win/Input.cpp | 6 ++++++ 4 files changed, 34 insertions(+), 28 deletions(-) create mode 100644 src/event/linux/Input.cpp create mode 100644 src/event/mac/Input.cpp create mode 100644 src/event/win/Input.cpp diff --git a/src/event/Input.cpp b/src/event/Input.cpp index 6ce998c..28859bb 100644 --- a/src/event/Input.cpp +++ b/src/event/Input.cpp @@ -566,34 +566,6 @@ const char* KeyCodeToString(KEY key) { return "UNKNOWN"; } -int32_t OsInputGet(OSINPUT* id, int32_t* param0, int32_t* param1, int32_t* param2, int32_t* param3) { - #if defined(WHOA_SYSTEM_WIN) - // TODO - return 0; - #endif - - #if defined(WHOA_SYSTEM_MAC) - // TODO - // Unknown logic - - if (!OsInputIsUsingCocoaEventLoop()) { - // Legacy Carbon input handling - return 0; - } - - // TODO - // Steelseries WoW Mouse logic - - if (Input::s_queueTail == Input::s_queueHead) { - return 0; - } - - OsQueueSetParam(3, OsGetAsyncTimeMs()); - - return OsQueueGet(id, param0, param1, param2, param3); - #endif -} - void OsInputInitialize() { #if defined(WHOA_SYSTEM_WIN) Input::s_numlockState = GetAsyncKeyState(144); diff --git a/src/event/linux/Input.cpp b/src/event/linux/Input.cpp new file mode 100644 index 0000000..38475df --- /dev/null +++ b/src/event/linux/Input.cpp @@ -0,0 +1,6 @@ +#include "event/Input.hpp" + +int32_t OsInputGet(OSINPUT* id, int32_t* param0, int32_t* param1, int32_t* param2, int32_t* param3) { + // TODO + return 0; +} diff --git a/src/event/mac/Input.cpp b/src/event/mac/Input.cpp new file mode 100644 index 0000000..e6c1ded --- /dev/null +++ b/src/event/mac/Input.cpp @@ -0,0 +1,22 @@ +#include "event/Input.hpp" + +int32_t OsInputGet(OSINPUT* id, int32_t* param0, int32_t* param1, int32_t* param2, int32_t* param3) { + // TODO + // Unknown logic + + if (!OsInputIsUsingCocoaEventLoop()) { + // Legacy Carbon input handling + return 0; + } + + // TODO + // Steelseries WoW Mouse logic + + if (Input::s_queueTail == Input::s_queueHead) { + return 0; + } + + OsQueueSetParam(3, OsGetAsyncTimeMs()); + + return OsQueueGet(id, param0, param1, param2, param3); +} diff --git a/src/event/win/Input.cpp b/src/event/win/Input.cpp new file mode 100644 index 0000000..38475df --- /dev/null +++ b/src/event/win/Input.cpp @@ -0,0 +1,6 @@ +#include "event/Input.hpp" + +int32_t OsInputGet(OSINPUT* id, int32_t* param0, int32_t* param1, int32_t* param2, int32_t* param3) { + // TODO + return 0; +}