diff --git a/src/client/Console.cpp b/src/client/Console.cpp index 2824383..f16deba 100644 --- a/src/client/Console.cpp +++ b/src/client/Console.cpp @@ -1,5 +1,5 @@ #include "client/Console.hpp" -#include "event/Window.hpp" +#include "event/Input.hpp" #include "gx/Device.hpp" #include "util/CVar.hpp" #include diff --git a/src/event/Input.hpp b/src/event/Input.hpp index e2b6569..e44adb6 100644 --- a/src/event/Input.hpp +++ b/src/event/Input.hpp @@ -53,6 +53,8 @@ void IEvtInputSetMouseMode(EvtContext* context, MOUSEMODE mode, uint32_t holdBut const char* KeyCodeToString(KEY key); +int32_t OsGuiProcessMessage(void* message); + int32_t OsInputGet(OSINPUT* id, int32_t* param0, int32_t* param1, int32_t* param2, int32_t* param3); void OsInputInitialize(); @@ -69,4 +71,6 @@ void OsQueuePut(OSINPUT id, int32_t param0, int32_t param1, int32_t param2, int3 void OsQueueSetParam(int32_t index, int32_t param); +int32_t OsWindowProc(void* window, uint32_t message, uintptr_t wparam, intptr_t lparam); + #endif diff --git a/src/event/Window.hpp b/src/event/Window.hpp deleted file mode 100644 index 0772910..0000000 --- a/src/event/Window.hpp +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef EVENT_WINDOW_HPP -#define EVENT_WINDOW_HPP - -#include - -int32_t OsGuiProcessMessage(void* message); - -int32_t OsWindowProc(void* window, uint32_t message, uintptr_t wparam, intptr_t lparam); - -#endif diff --git a/src/event/linux/Input.cpp b/src/event/linux/Input.cpp index 72b06de..3a019a2 100644 --- a/src/event/linux/Input.cpp +++ b/src/event/linux/Input.cpp @@ -1,5 +1,9 @@ #include "event/Input.hpp" +int32_t OsGuiProcessMessage(void* message) { + return 0; +} + int32_t OsInputGet(OSINPUT* id, int32_t* param0, int32_t* param1, int32_t* param2, int32_t* param3) { // TODO return 0; @@ -8,3 +12,7 @@ int32_t OsInputGet(OSINPUT* id, int32_t* param0, int32_t* param1, int32_t* param void OsInputSetMouseMode(OS_MOUSE_MODE mode) { // TODO } + +int32_t OsWindowProc(void* window, uint32_t message, uintptr_t wparam, intptr_t lparam) { + return 0; +} diff --git a/src/event/linux/Window.cpp b/src/event/linux/Window.cpp deleted file mode 100644 index 971365c..0000000 --- a/src/event/linux/Window.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "event/Window.hpp" - -int32_t OsGuiProcessMessage(void* message) { - return 0; -} - -int32_t OsWindowProc(void* window, uint32_t message, uintptr_t wparam, intptr_t lparam) { - return 0; -} diff --git a/src/event/mac/Input.cpp b/src/event/mac/Input.cpp index 65cf626..3a635bd 100644 --- a/src/event/mac/Input.cpp +++ b/src/event/mac/Input.cpp @@ -1,6 +1,10 @@ #include "event/Input.hpp" #include +int32_t OsGuiProcessMessage(void* message) { + return 0; +} + int32_t OsInputGet(OSINPUT* id, int32_t* param0, int32_t* param1, int32_t* param2, int32_t* param3) { // TODO // Unknown logic @@ -25,3 +29,7 @@ int32_t OsInputGet(OSINPUT* id, int32_t* param0, int32_t* param1, int32_t* param void OsInputSetMouseMode(OS_MOUSE_MODE mode) { // TODO } + +int32_t OsWindowProc(void* window, uint32_t message, uintptr_t wparam, intptr_t lparam) { + return 0; +} diff --git a/src/event/mac/Window.cpp b/src/event/mac/Window.cpp deleted file mode 100644 index 971365c..0000000 --- a/src/event/mac/Window.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "event/Window.hpp" - -int32_t OsGuiProcessMessage(void* message) { - return 0; -} - -int32_t OsWindowProc(void* window, uint32_t message, uintptr_t wparam, intptr_t lparam) { - return 0; -} diff --git a/src/event/win/Input.cpp b/src/event/win/Input.cpp index 887e774..53d15d6 100644 --- a/src/event/win/Input.cpp +++ b/src/event/win/Input.cpp @@ -1,5 +1,4 @@ #include "event/Input.hpp" -#include "event/Window.hpp" #include #include @@ -11,6 +10,11 @@ void RestoreMouse() { // TODO } +int32_t OsGuiProcessMessage(void* message) { + // TODO + return 0; +} + int32_t OsInputGet(OSINPUT* id, int32_t* param0, int32_t* param1, int32_t* param2, int32_t* param3) { // TODO window rect comparisons @@ -74,3 +78,39 @@ void OsInputSetMouseMode(OS_MOUSE_MODE mode) { CenterMouse(); } } + +int32_t OsWindowProc(void* window, uint32_t message, uintptr_t wparam, intptr_t lparam) { + auto hwnd = static_cast(window); + + // TODO + + switch (message) { + // TODO handle remaining message types + + case WM_ACTIVATE: { + auto isMinimized = IsIconic(hwnd); + auto isActive = wparam != WA_INACTIVE; + Input::s_windowFocused = isActive && !isMinimized; + + // TODO capture + + // TODO mouse speed + + OsQueuePut(OS_INPUT_FOCUS, Input::s_windowFocused != 0, 0, 0, 0); + + break; + } + + case WM_CLOSE: { + OsQueuePut(OS_INPUT_CLOSE, 0, 0, 0, 0); + return 0; + } + + default: + break; + } + + // TODO + + return DefWindowProc(static_cast(window), message, wparam, lparam); +} diff --git a/src/event/win/Window.cpp b/src/event/win/Window.cpp deleted file mode 100644 index 2174cd4..0000000 --- a/src/event/win/Window.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "event/Window.hpp" -#include "event/Input.hpp" -#include - -int32_t OsGuiProcessMessage(void* message) { - // TODO - return 0; -} - -int32_t OsWindowProc(void* window, uint32_t message, uintptr_t wparam, intptr_t lparam) { - auto hwnd = static_cast(window); - - // TODO - - switch (message) { - // TODO handle remaining message types - - case WM_ACTIVATE: { - auto isMinimized = IsIconic(hwnd); - auto isActive = wparam != WA_INACTIVE; - Input::s_windowFocused = isActive && !isMinimized; - - // TODO capture - - // TODO mouse speed - - OsQueuePut(OS_INPUT_FOCUS, Input::s_windowFocused != 0, 0, 0, 0); - - break; - } - - case WM_CLOSE: { - OsQueuePut(OS_INPUT_CLOSE, 0, 0, 0, 0); - return 0; - } - - default: - break; - } - - // TODO - - return DefWindowProc(static_cast(window), message, wparam, lparam); -}