From b7c4620007274844669337df703aba206ea6c4d3 Mon Sep 17 00:00:00 2001 From: Yuqian Yang Date: Fri, 28 Nov 2025 13:31:36 +0800 Subject: Impl sdl create native window. --- include/cru/platform/gui/sdl/Window.h | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'include/cru/platform/gui/sdl/Window.h') diff --git a/include/cru/platform/gui/sdl/Window.h b/include/cru/platform/gui/sdl/Window.h index 0fd9b8e6..c9d6505b 100644 --- a/include/cru/platform/gui/sdl/Window.h +++ b/include/cru/platform/gui/sdl/Window.h @@ -1,8 +1,9 @@ #pragma once -#include "../../GraphicsBase.h" -#include "../Window.h" #include "Base.h" +#include +#include + #include #include @@ -39,7 +40,17 @@ class SdlWindow : public SdlResource, public virtual INativeWindow { Rect GetClientRect() override; void SetClientRect(const Rect& rect) override; + /** + * Note: When the window is not created, this method will return an empty rect + * regardless of whether the window has a border. + */ Rect GetWindowRect() override; + + /** + * Note: When the window is not created, the border is always considered empty + * regardless of the window style flag. So, you should always call this method + * after the window is created. + */ void SetWindowRect(const Rect& rect) override; bool RequestFocus() override; @@ -67,7 +78,7 @@ class SdlWindow : public SdlResource, public virtual INativeWindow { float GetDisplayScale(); Thickness GetBorderThickness(); - private: + private: void DoCreateWindow(); void DoUpdateClientRect(); void DoUpdateParent(); @@ -76,7 +87,7 @@ class SdlWindow : public SdlResource, public virtual INativeWindow { private: SdlUiApplication* application_; - std::optional sdl_window_; + SDL_Window* sdl_window_; Rect client_rect_; SdlWindow* parent_; EventHandlerRevokerGuard parent_create_guard_; -- cgit v1.2.3