diff options
Diffstat (limited to 'include/cru/platform')
| -rw-r--r-- | include/cru/platform/GraphicsBase.h | 7 | ||||
| -rw-r--r-- | include/cru/platform/gui/sdl/Window.h | 3 |
2 files changed, 9 insertions, 1 deletions
diff --git a/include/cru/platform/GraphicsBase.h b/include/cru/platform/GraphicsBase.h index dccff4e1..81c44cb6 100644 --- a/include/cru/platform/GraphicsBase.h +++ b/include/cru/platform/GraphicsBase.h @@ -157,7 +157,8 @@ struct Rect final { constexpr static Rect FromVertices(const Point& lefttop, const Point& rightbottom) { - return Rect(lefttop.x, lefttop.y, rightbottom.x - lefttop.x, rightbottom.y - lefttop.y); + return Rect(lefttop.x, lefttop.y, rightbottom.x - lefttop.x, + rightbottom.y - lefttop.y); } constexpr static Rect FromCenter(const Point& center, const float width, @@ -215,6 +216,10 @@ struct Rect final { return result; } + constexpr Rect Scale(float scale) const { + return {left * scale, top * scale, width * scale, height * scale}; + } + constexpr bool IsPointInside(const Point& point) const { return point.x >= left && point.x < GetRight() && point.y >= top && point.y < GetBottom(); diff --git a/include/cru/platform/gui/sdl/Window.h b/include/cru/platform/gui/sdl/Window.h index 78fbaa93..98166128 100644 --- a/include/cru/platform/gui/sdl/Window.h +++ b/include/cru/platform/gui/sdl/Window.h @@ -64,10 +64,13 @@ class SdlWindow : public SdlResource, public virtual INativeWindow { public: std::optional<SDL_Window*> GetSdlWindow(); SdlUiApplication* GetSdlUiApplication(); + float GetDisplayScale(); + Thickness GetBorderThickness(); private: SdlUiApplication* application_; std::optional<SDL_Window*> sdl_window_; + Rect client_rect_; SdlWindow* parent_; WindowStyleFlag style_; }; |
