aboutsummaryrefslogtreecommitdiff
path: root/include/cru/platform/gui
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-11-28 13:31:36 +0800
committerYuqian Yang <crupest@crupest.life>2025-11-28 13:31:36 +0800
commitb7c4620007274844669337df703aba206ea6c4d3 (patch)
treee5e5033566e04f8f4e17b21e21ecbe14a21c2662 /include/cru/platform/gui
parent06cded30294ac02a78ede7083eaf769c772a0ed1 (diff)
downloadcru-b7c4620007274844669337df703aba206ea6c4d3.tar.gz
cru-b7c4620007274844669337df703aba206ea6c4d3.tar.bz2
cru-b7c4620007274844669337df703aba206ea6c4d3.zip
Impl sdl create native window.
Diffstat (limited to 'include/cru/platform/gui')
-rw-r--r--include/cru/platform/gui/sdl/Window.h19
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_;