From 1983a6789e12cb003ae457d68836be17bc4fbeba Mon Sep 17 00:00:00 2001 From: Brett Date: Sun, 27 Oct 2024 18:10:55 -0400 Subject: [PATCH] extra settings for window --- CMakeLists.txt | 2 +- include/blt/gfx/window.h | 10 ++++++++++ libraries/BLT | 2 +- libraries/imgui | 2 +- libraries/openal-soft | 2 +- src/blt/gfx/window.cpp | 25 ++++++++++++++++++++++++- 6 files changed, 38 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a56899..fd4a722 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.25) -set(BLT_GRAPHICS_VERSION 0.13.36) +set(BLT_GRAPHICS_VERSION 0.13.37) set(BLT_GRAPHICS_TEST_VERSION 0.0.1) project(BLT_WITH_GRAPHICS VERSION ${BLT_GRAPHICS_VERSION}) diff --git a/include/blt/gfx/window.h b/include/blt/gfx/window.h index 745e280..8f7747c 100644 --- a/include/blt/gfx/window.h +++ b/include/blt/gfx/window.h @@ -36,6 +36,10 @@ namespace blt::gfx std::string title; std::int32_t width; std::int32_t height; + GLFWmonitor* monitor = nullptr; + GLFWwindow* share = nullptr; + GLFWwindow* window = nullptr; + std::int32_t maximized = GLFW_FALSE; window_context context{}; std::int32_t sync_interval = 0; @@ -86,6 +90,12 @@ namespace blt::gfx sync_interval = sync; return *this; } + + window_data& setMonitor(GLFWmonitor* monitor); + + window_data& setShare(GLFWwindow* share); + + window_data& setMaximized(bool b); }; void init(window_data data); diff --git a/libraries/BLT b/libraries/BLT index 3003e42..e81f590 160000 --- a/libraries/BLT +++ b/libraries/BLT @@ -1 +1 @@ -Subproject commit 3003e424e17a5c639a8b89d5c721c94c47f3402a +Subproject commit e81f590f5e4f8c79ec99307fcf7d7cbbfcc83217 diff --git a/libraries/imgui b/libraries/imgui index 4d00bf8..ccb6646 160000 --- a/libraries/imgui +++ b/libraries/imgui @@ -1 +1 @@ -Subproject commit 4d00bf8add44155a4f6b489538bd77d6214a4432 +Subproject commit ccb6646baeac88d276078ebade5616f4c6d7c03a diff --git a/libraries/openal-soft b/libraries/openal-soft index 7ac9a5c..c2a15a0 160000 --- a/libraries/openal-soft +++ b/libraries/openal-soft @@ -1 +1 @@ -Subproject commit 7ac9a5c2b1264fbba2fff2b67a83d820d5449df7 +Subproject commit c2a15a0c7c5ec8dc774b110de1cbe54b26fe0c3f diff --git a/src/blt/gfx/window.cpp b/src/blt/gfx/window.cpp index 79f3005..8cd93a6 100644 --- a/src/blt/gfx/window.cpp +++ b/src/blt/gfx/window.cpp @@ -243,9 +243,11 @@ namespace blt::gfx glfwWindowHint(GLFW_DOUBLEBUFFER, data.context.DOUBLE_BUFFER); glfwWindowHint(GLFW_OPENGL_PROFILE, data.context.GL_PROFILE); glfwWindowHint(GLFW_SAMPLES, data.context.SAMPLES); + glfwWindowHint(GLFW_MAXIMIZED, data.maximized); /* -- Create the Window -- */ - window_state.window = glfwCreateWindow(data.width, data.height, data.title.c_str(), nullptr, nullptr); + window_state.window = glfwCreateWindow(data.width, data.height, data.title.c_str(), data.monitor, data.share); + data.window = window_state.window; BLT_ASSERT(window_state.window && "Unable to create GLFW window."); /* -- Set Window Specifics + OpenGL -- */ @@ -401,4 +403,25 @@ namespace blt::gfx glfwSetWindowSize(window_state.window, width, height); return *this; } + + window_data& window_data::setMonitor(GLFWmonitor* m) + { + window_data::monitor = m; + return *this; + } + + window_data& window_data::setShare(GLFWwindow* s) + { + window_data::share = s; + return *this; + } + + window_data& window_data::setMaximized(bool b) + { + if (b) + window_data::maximized = GLFW_TRUE; + else + window_data::maximized = GLFW_FALSE; + return *this; + } }