From 32f9c81abfdd88ca3b0a241637927cef6e827274 Mon Sep 17 00:00:00 2001 From: fallenoak Date: Tue, 14 Mar 2023 17:15:54 -0500 Subject: [PATCH] feat(event): pass custom window proc in gx device creation --- src/client/Console.cpp | 3 ++- src/event/CMakeLists.txt | 14 ++++++++++++++ src/event/Window.hpp | 8 ++++++++ src/event/linux/Window.cpp | 5 +++++ src/event/mac/Window.cpp | 5 +++++ src/event/win/Window.cpp | 7 +++++++ 6 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 src/event/Window.hpp create mode 100644 src/event/linux/Window.cpp create mode 100644 src/event/mac/Window.cpp create mode 100644 src/event/win/Window.cpp diff --git a/src/client/Console.cpp b/src/client/Console.cpp index ea80374..2824383 100644 --- a/src/client/Console.cpp +++ b/src/client/Console.cpp @@ -1,4 +1,5 @@ #include "client/Console.hpp" +#include "event/Window.hpp" #include "gx/Device.hpp" #include "util/CVar.hpp" #include @@ -200,7 +201,7 @@ void ConsoleDeviceInitialize(const char* title) { api = GxApi_GLL; #endif - CGxDevice* device = GxDevCreate(api, nullptr, format); + CGxDevice* device = GxDevCreate(api, OsWindowProc, format); // TODO } diff --git a/src/event/CMakeLists.txt b/src/event/CMakeLists.txt index 159bcd0..0d619de 100644 --- a/src/event/CMakeLists.txt +++ b/src/event/CMakeLists.txt @@ -1,5 +1,12 @@ file(GLOB PRIVATE_SOURCES "*.cpp") +if(WHOA_SYSTEM_WIN) + file(GLOB WIN_SOURCES + "win/*.cpp" + ) + list(APPEND PRIVATE_SOURCES ${WIN_SOURCES}) +endif() + if(WHOA_SYSTEM_MAC) file(GLOB MAC_SOURCES "mac/*.cpp" @@ -8,6 +15,13 @@ if(WHOA_SYSTEM_MAC) list(APPEND PRIVATE_SOURCES ${MAC_SOURCES}) endif() +if(WHOA_SYSTEM_LINUX) + file(GLOB LINUX_SOURCES + "linux/*.cpp" + ) + list(APPEND PRIVATE_SOURCES ${LINUX_SOURCES}) +endif() + add_library(event STATIC ${PRIVATE_SOURCES} ) diff --git a/src/event/Window.hpp b/src/event/Window.hpp new file mode 100644 index 0000000..e8c09e7 --- /dev/null +++ b/src/event/Window.hpp @@ -0,0 +1,8 @@ +#ifndef EVENT_WINDOW_HPP +#define EVENT_WINDOW_HPP + +#include + +int32_t OsWindowProc(void* window, uint32_t message, uint32_t wparam, int32_t lparam); + +#endif diff --git a/src/event/linux/Window.cpp b/src/event/linux/Window.cpp new file mode 100644 index 0000000..0fcd4ca --- /dev/null +++ b/src/event/linux/Window.cpp @@ -0,0 +1,5 @@ +#include "event/Window.hpp" + +int32_t OsWindowProc(void* window, uint32_t message, uint32_t wparam, int32_t lparam) { + return 0; +} diff --git a/src/event/mac/Window.cpp b/src/event/mac/Window.cpp new file mode 100644 index 0000000..0fcd4ca --- /dev/null +++ b/src/event/mac/Window.cpp @@ -0,0 +1,5 @@ +#include "event/Window.hpp" + +int32_t OsWindowProc(void* window, uint32_t message, uint32_t wparam, int32_t lparam) { + return 0; +} diff --git a/src/event/win/Window.cpp b/src/event/win/Window.cpp new file mode 100644 index 0000000..50c16e6 --- /dev/null +++ b/src/event/win/Window.cpp @@ -0,0 +1,7 @@ +#include "event/Window.hpp" +#include + +int32_t OsWindowProc(void* window, uint32_t message, uint32_t wparam, int32_t lparam) { + // TODO + return 0; +}