diff options
| author | Yuqian Yang <crupest@crupest.life> | 2025-11-28 13:31:36 +0800 |
|---|---|---|
| committer | Yuqian Yang <crupest@crupest.life> | 2025-11-28 13:31:36 +0800 |
| commit | b7c4620007274844669337df703aba206ea6c4d3 (patch) | |
| tree | e5e5033566e04f8f4e17b21e21ecbe14a21c2662 /include/cru/platform/gui/sdl | |
| parent | 06cded30294ac02a78ede7083eaf769c772a0ed1 (diff) | |
| download | cru-b7c4620007274844669337df703aba206ea6c4d3.tar.gz cru-b7c4620007274844669337df703aba206ea6c4d3.tar.bz2 cru-b7c4620007274844669337df703aba206ea6c4d3.zip | |
Impl sdl create native window.
Diffstat (limited to 'include/cru/platform/gui/sdl')
| -rw-r--r-- | include/cru/platform/gui/sdl/Window.h | 19 |
1 files changed, 15 insertions, 4 deletions
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 <cru/platform/GraphicsBase.h> +#include <cru/platform/gui/Window.h> + #include <SDL3/SDL_video.h> #include <optional> @@ -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* sdl_window_; Rect client_rect_; SdlWindow* parent_; EventHandlerRevokerGuard parent_create_guard_; |
