From fb9e93d9cf5ab60c041313bae4c28498f71be945 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hatvani=20Tam=C3=A1s?= Date: Wed, 15 Apr 2026 10:28:11 +0200 Subject: [PATCH] changed m_Flags from pointer to stack var --- SakuraCore/src/Window.cpp | 12 ++++-------- SakuraCore/src/Window.h | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/SakuraCore/src/Window.cpp b/SakuraCore/src/Window.cpp index 25f63b9..356dbda 100644 --- a/SakuraCore/src/Window.cpp +++ b/SakuraCore/src/Window.cpp @@ -12,15 +12,11 @@ Window::Window(const WindowData &data) : m_Data(data) {} Window::~Window() { Destroy(); } bool Window::Create(std::span flags) { - SDL_WindowFlags windowFlags = (SDL_WindowFlags)(SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIGH_PIXEL_DENSITY); - for (auto &flag : flags) { - windowFlags |= flag; + m_Flags |= flag; } - *m_Flags = windowFlags; - - m_Handle = SDL_CreateWindow(m_Data.title.c_str(), m_Data.width, m_Data.height, windowFlags); + m_Handle = SDL_CreateWindow(m_Data.title.c_str(), m_Data.width, m_Data.height, m_Flags); if (!m_Handle) { LOG_ERROR("SDL window could not be created! {0}", SDL_GetError()); @@ -142,7 +138,7 @@ void Window::AddFlags(std::span flags) { break; } - *m_Flags |= flag; + m_Flags |= flag; } } @@ -191,7 +187,7 @@ void Window::RemoveFlags(std::span flags) { break; } - *m_Flags |= flag; + m_Flags |= flag; } } diff --git a/SakuraCore/src/Window.h b/SakuraCore/src/Window.h index e836847..6c1fb47 100644 --- a/SakuraCore/src/Window.h +++ b/SakuraCore/src/Window.h @@ -47,7 +47,7 @@ public: private: WindowData m_Data; SDL_Window *m_Handle = nullptr; - SDL_WindowFlags *m_Flags = nullptr; + SDL_WindowFlags m_Flags; float *m_MouseXPos = nullptr; float *m_MouseYPos = nullptr; };