feat(client): migrate gui functions and implement OsGuiGetWindow

This commit is contained in:
fallenoak 2023-03-20 00:06:50 -05:00 committed by GitHub
parent acaa42019a
commit ba790418e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 120 additions and 33 deletions

View File

@ -1,4 +1,28 @@
file(GLOB PRIVATE_SOURCES "*.cpp")
file(GLOB PRIVATE_SOURCES
"*.cpp"
"gui/*.cpp"
)
if(WHOA_SYSTEM_WIN)
file(GLOB WIN_SOURCES
"gui/win/*.cpp"
)
list(APPEND PRIVATE_SOURCES ${WIN_SOURCES})
endif()
if(WHOA_SYSTEM_MAC)
file(GLOB MAC_SOURCES
"gui/mac/*.cpp"
)
list(APPEND PRIVATE_SOURCES ${MAC_SOURCES})
endif()
if(WHOA_SYSTEM_LINUX)
file(GLOB LINUX_SOURCES
"gui/linux/*.cpp"
)
list(APPEND PRIVATE_SOURCES ${LINUX_SOURCES})
endif()
add_library(client STATIC
${PRIVATE_SOURCES}

View File

@ -1,4 +1,5 @@
#include "client/Console.hpp"
#include "client/Gui.hpp"
#include "event/Input.hpp"
#include "gx/Device.hpp"
#include "util/CVar.hpp"
@ -204,4 +205,9 @@ void ConsoleDeviceInitialize(const char* title) {
CGxDevice* device = GxDevCreate(api, OsWindowProc, format);
// TODO
auto gxWindow = GxDevWindow();
OsGuiSetGxWindow(gxWindow);
// TODO
}

6
src/client/Gui.hpp Normal file
View File

@ -0,0 +1,6 @@
#ifndef CLIENT_GUI_HPP
#define CLIENT_GUI_HPP
#include "gui/OsGui.hpp"
#endif

14
src/client/gui/OsGui.hpp Normal file
View File

@ -0,0 +1,14 @@
#ifndef CLIENT_GUI_OS_GUI_HPP
#define CLIENT_GUI_OS_GUI_HPP
#include <cstdint>
void* OsGuiGetWindow(int32_t type);
bool OsGuiIsModifierKeyDown(int32_t key);
int32_t OsGuiProcessMessage(void* message);
void OsGuiSetGxWindow(void* window);
#endif

View File

@ -0,0 +1,18 @@
#include "client/gui/OsGui.hpp"
void* OsGuiGetWindow(int32_t type) {
return nullptr;
}
bool OsGuiIsModifierKeyDown(int32_t key) {
// TODO
return false;
}
int32_t OsGuiProcessMessage(void* message) {
return 0;
}
void OsGuiSetGxWindow(void* window) {
// TODO
}

View File

@ -0,0 +1,18 @@
#include "client/gui/OsGui.hpp"
void* OsGuiGetWindow(int32_t type) {
return nullptr;
}
bool OsGuiIsModifierKeyDown(int32_t key) {
// TODO
return false;
}
int32_t OsGuiProcessMessage(void* message) {
return 0;
}
void OsGuiSetGxWindow(void* window) {
// TODO
}

View File

@ -0,0 +1,31 @@
#include "client/gui/OsGui.hpp"
#include <windows.h>
static void* s_GxDevWindow;
void* OsGuiGetWindow(int32_t type) {
switch (type) {
case 0:
return s_GxDevWindow;
case 1:
return GetActiveWindow();
case 2:
return GetForegroundWindow();
default:
return nullptr;
}
}
bool OsGuiIsModifierKeyDown(int32_t key) {
// TODO
return false;
}
int32_t OsGuiProcessMessage(void* message) {
// TODO
return 0;
}
void OsGuiSetGxWindow(void* window) {
s_GxDevWindow = window;
}

View File

@ -33,6 +33,7 @@ target_include_directories(event
target_link_libraries(event
PRIVATE
client
gx
PUBLIC
common

View File

@ -54,10 +54,6 @@ void IEvtInputSetMouseMode(EvtContext* context, MOUSEMODE mode, uint32_t holdBut
const char* KeyCodeToString(KEY key);
bool OsGuiIsModifierKeyDown(int32_t 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();

View File

@ -1,14 +1,5 @@
#include "event/Input.hpp"
bool OsGuiIsModifierKeyDown(int32_t key) {
// TODO
return false;
}
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;

View File

@ -1,15 +1,6 @@
#include "event/Input.hpp"
#include <common/Time.hpp>
bool OsGuiIsModifierKeyDown(int32_t key) {
// TODO
return false;
}
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

View File

@ -1,4 +1,5 @@
#include "event/Input.hpp"
#include "client/Gui.hpp"
#include <storm/Error.hpp>
#include <windows.h>
@ -231,16 +232,6 @@ int32_t HandleMouseUp(uint32_t message, uintptr_t wparam, bool* xbutton, HWND hw
return 1;
}
bool OsGuiIsModifierKeyDown(int32_t key) {
// TODO
return false;
}
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