setWindowSize as global function
parent
64223a0cfd
commit
cab763c18d
|
@ -1,7 +1,7 @@
|
||||||
cmake_minimum_required(VERSION 3.25)
|
cmake_minimum_required(VERSION 3.25)
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
|
|
||||||
set(BLT_GRAPHICS_VERSION 2.0.3)
|
set(BLT_GRAPHICS_VERSION 2.0.4)
|
||||||
set(BLT_GRAPHICS_TEST_VERSION 0.0.1)
|
set(BLT_GRAPHICS_TEST_VERSION 0.0.1)
|
||||||
|
|
||||||
project(BLT_WITH_GRAPHICS VERSION ${BLT_GRAPHICS_VERSION})
|
project(BLT_WITH_GRAPHICS VERSION ${BLT_GRAPHICS_VERSION})
|
||||||
|
|
|
@ -155,7 +155,9 @@ namespace blt::gfx
|
||||||
i32 getWindowWidth();
|
i32 getWindowWidth();
|
||||||
|
|
||||||
i32 getWindowHeight();
|
i32 getWindowHeight();
|
||||||
|
|
||||||
|
void setWindowSize(i32 width, i32 height);
|
||||||
|
|
||||||
void cleanup();
|
void cleanup();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,7 @@ namespace blt::gfx
|
||||||
std::int64_t deltaTime = 0;
|
std::int64_t deltaTime = 0;
|
||||||
double nanoDelta = 0;
|
double nanoDelta = 0;
|
||||||
double millisDelta = 0;
|
double millisDelta = 0;
|
||||||
|
window_data* data = nullptr;
|
||||||
} window_state;
|
} window_state;
|
||||||
|
|
||||||
void create_callbacks()
|
void create_callbacks()
|
||||||
|
@ -226,6 +227,7 @@ namespace blt::gfx
|
||||||
|
|
||||||
void init(window_data data)
|
void init(window_data data)
|
||||||
{
|
{
|
||||||
|
window_state.data = &data; // NOLINT
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
blt::logging::setLogOutputFormat("[${{TIME}}] [${{LOG_LEVEL}}] (${{FILE}}:${{LINE}}) ${{STR}}\n");
|
blt::logging::setLogOutputFormat("[${{TIME}}] [${{LOG_LEVEL}}] (${{FILE}}:${{LINE}}) ${{STR}}\n");
|
||||||
emscripten_set_resize_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, nullptr, false,
|
emscripten_set_resize_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, nullptr, false,
|
||||||
|
@ -399,7 +401,12 @@ namespace blt::gfx
|
||||||
|
|
||||||
bool mouseReleaseLastFrame()
|
bool mouseReleaseLastFrame()
|
||||||
{ return window_state.inputManager.mouse_released; }
|
{ 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)
|
window_data& window_data::setWindowSize(int32_t new_width, int32_t new_height)
|
||||||
{
|
{
|
||||||
width = new_width;
|
width = new_width;
|
||||||
|
|
Loading…
Reference in New Issue