diff --git a/CMakeLists.txt b/CMakeLists.txt index 23e1dfb..04c574e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.25) include(FetchContent) -set(BLT_GRAPHICS_VERSION 2.0.3) +set(BLT_GRAPHICS_VERSION 2.0.4) 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 a20a0a5..3347fa7 100644 --- a/include/blt/gfx/window.h +++ b/include/blt/gfx/window.h @@ -155,7 +155,9 @@ namespace blt::gfx i32 getWindowWidth(); i32 getWindowHeight(); - + + void setWindowSize(i32 width, i32 height); + void cleanup(); diff --git a/src/blt/gfx/window.cpp b/src/blt/gfx/window.cpp index 24b9cfb..900de13 100644 --- a/src/blt/gfx/window.cpp +++ b/src/blt/gfx/window.cpp @@ -62,6 +62,7 @@ namespace blt::gfx std::int64_t deltaTime = 0; double nanoDelta = 0; double millisDelta = 0; + window_data* data = nullptr; } window_state; void create_callbacks() @@ -226,6 +227,7 @@ namespace blt::gfx void init(window_data data) { + window_state.data = &data; // NOLINT #ifdef __EMSCRIPTEN__ blt::logging::setLogOutputFormat("[${{TIME}}] [${{LOG_LEVEL}}] (${{FILE}}:${{LINE}}) ${{STR}}\n"); emscripten_set_resize_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, nullptr, false, @@ -399,7 +401,12 @@ namespace blt::gfx bool mouseReleaseLastFrame() { return window_state.inputManager.mouse_released; } - + + void setWindowSize(const i32 width, const i32 height) + { + window_state.data->setWindowSize(width, height); + } + window_data& window_data::setWindowSize(int32_t new_width, int32_t new_height) { width = new_width;