mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-04-17 10:32:45 +03:00
feat(client): migrate gui functions and implement OsGuiGetWindow
This commit is contained in:
parent
acaa42019a
commit
ba790418e1
src
client
event
@ -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}
|
||||
|
@ -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
6
src/client/Gui.hpp
Normal 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
14
src/client/gui/OsGui.hpp
Normal 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
|
18
src/client/gui/linux/OsGui.cpp
Normal file
18
src/client/gui/linux/OsGui.cpp
Normal 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
|
||||
}
|
18
src/client/gui/mac/OsGui.cpp
Normal file
18
src/client/gui/mac/OsGui.cpp
Normal 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
|
||||
}
|
31
src/client/gui/win/OsGui.cpp
Normal file
31
src/client/gui/win/OsGui.cpp
Normal 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;
|
||||
}
|
@ -33,6 +33,7 @@ target_include_directories(event
|
||||
|
||||
target_link_libraries(event
|
||||
PRIVATE
|
||||
client
|
||||
gx
|
||||
PUBLIC
|
||||
common
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user