From b0566ad8d73ac52a0546337f0aa3b5d6916ddf21 Mon Sep 17 00:00:00 2001 From: superp00t Date: Fri, 6 Sep 2024 23:39:33 -0400 Subject: [PATCH] feat(client): OsGui functions for linux --- src/client/CMakeLists.txt | 6 +++--- src/client/Gui.hpp | 2 +- src/client/gui/linux/OsGui.cpp | 11 +++++++++-- src/event/sdl/Input.cpp | 9 ++++++--- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt index 4f47b79..b0d73ab 100644 --- a/src/client/CMakeLists.txt +++ b/src/client/CMakeLists.txt @@ -3,21 +3,21 @@ file(GLOB PRIVATE_SOURCES "gui/*.cpp" ) -if(WHOA_SYSTEM_WIN) +if (WHOA_SYSTEM_WIN) file(GLOB WIN_SOURCES "gui/win/*.cpp" ) list(APPEND PRIVATE_SOURCES ${WIN_SOURCES}) endif() -if(WHOA_SYSTEM_MAC) +if (WHOA_SYSTEM_MAC) file(GLOB MAC_SOURCES "gui/mac/*.cpp" ) list(APPEND PRIVATE_SOURCES ${MAC_SOURCES}) endif() -if(WHOA_SYSTEM_LINUX) +if (WHOA_SYSTEM_LINUX) file(GLOB LINUX_SOURCES "gui/linux/*.cpp" ) diff --git a/src/client/Gui.hpp b/src/client/Gui.hpp index 0e43f58..b230629 100644 --- a/src/client/Gui.hpp +++ b/src/client/Gui.hpp @@ -1,6 +1,6 @@ #ifndef CLIENT_GUI_HPP #define CLIENT_GUI_HPP -#include "gui/OsGui.hpp" +#include "client/gui/OsGui.hpp" #endif diff --git a/src/client/gui/linux/OsGui.cpp b/src/client/gui/linux/OsGui.cpp index 151cefa..b2d57a4 100644 --- a/src/client/gui/linux/OsGui.cpp +++ b/src/client/gui/linux/OsGui.cpp @@ -1,7 +1,14 @@ #include "client/gui/OsGui.hpp" +static void* s_GxDevWindow = nullptr; + void* OsGuiGetWindow(int32_t type) { - return nullptr; + switch (type) { + case 0: + return s_GxDevWindow; + default: + return nullptr; + } } bool OsGuiIsModifierKeyDown(int32_t key) { @@ -14,5 +21,5 @@ int32_t OsGuiProcessMessage(void* message) { } void OsGuiSetGxWindow(void* window) { - // TODO + s_GxDevWindow = window; } diff --git a/src/event/sdl/Input.cpp b/src/event/sdl/Input.cpp index 096ece0..2409c09 100644 --- a/src/event/sdl/Input.cpp +++ b/src/event/sdl/Input.cpp @@ -1,12 +1,13 @@ #include -#include -#include #include "event/sdl/Input.hpp" -#include "client/gui/OsGui.hpp" +#include "client/Gui.hpp" #include "gx/Device.hpp" #include "gx/Window.hpp" +#include +#include + static const std::unordered_map s_keyConversion = { { SDL_SCANCODE_LSHIFT, KEY_LSHIFT }, { SDL_SCANCODE_RSHIFT, KEY_RSHIFT }, @@ -287,6 +288,8 @@ int32_t SDLInputGet(OSINPUT* id, int32_t* param0, int32_t* param1, int32_t* para static_cast(bounds->left + width) }; SetSavedWindowBounds(newBounds); + + break; } case SDL_QUIT: { *id = OS_INPUT_CLOSE;