changed m_Flags from pointer to stack var

This commit is contained in:
2026-04-15 10:28:11 +02:00
parent e64fc16d6a
commit fb9e93d9cf
2 changed files with 5 additions and 9 deletions

View File

@@ -12,15 +12,11 @@ Window::Window(const WindowData &data) : m_Data(data) {}
Window::~Window() { Destroy(); } Window::~Window() { Destroy(); }
bool Window::Create(std::span<const SDL_WindowFlags> flags) { bool Window::Create(std::span<const SDL_WindowFlags> flags) {
SDL_WindowFlags windowFlags = (SDL_WindowFlags)(SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIGH_PIXEL_DENSITY);
for (auto &flag : flags) { 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, m_Flags);
m_Handle = SDL_CreateWindow(m_Data.title.c_str(), m_Data.width, m_Data.height, windowFlags);
if (!m_Handle) { if (!m_Handle) {
LOG_ERROR("SDL window could not be created! {0}", SDL_GetError()); LOG_ERROR("SDL window could not be created! {0}", SDL_GetError());
@@ -142,7 +138,7 @@ void Window::AddFlags(std::span<const SDL_WindowFlags> flags) {
break; break;
} }
*m_Flags |= flag; m_Flags |= flag;
} }
} }
@@ -191,7 +187,7 @@ void Window::RemoveFlags(std::span<const SDL_WindowFlags> flags) {
break; break;
} }
*m_Flags |= flag; m_Flags |= flag;
} }
} }

View File

@@ -47,7 +47,7 @@ public:
private: private:
WindowData m_Data; WindowData m_Data;
SDL_Window *m_Handle = nullptr; SDL_Window *m_Handle = nullptr;
SDL_WindowFlags *m_Flags = nullptr; SDL_WindowFlags m_Flags;
float *m_MouseXPos = nullptr; float *m_MouseXPos = nullptr;
float *m_MouseYPos = nullptr; float *m_MouseYPos = nullptr;
}; };