ZenitUI
Retained-mode C++20 UI framework
Loading...
Searching...
No Matches
SDL3Platform.hpp
1#pragma once
2
3#include "UIContext.hpp"
4
5#include <memory>
6#include <string>
7
8struct SDL_Window;
9
10namespace ZenitUI
11{
15
21 class SDL3Platform final : public IPlatform
22 {
23 public:
24 explicit SDL3Platform(SDL_Window *window);
25 ~SDL3Platform() override;
26
27 SDL3Platform(const SDL3Platform &) = delete;
28 SDL3Platform &operator=(const SDL3Platform &) = delete;
29
30 Vec2 viewportSize() override;
32 double time() override;
35 float dpiScale() override;
36 EdgeInsets safeArea() override;
37 void setClipboardText(const std::string &text) override;
38 std::string getClipboardText() override;
39 void setCursor(CursorShape cursor) override;
40 void setTextInputRect(Rect inputRect, float cursorXOffset = 0.0f) override;
41
42 private:
43 struct Impl;
44 std::unique_ptr<Impl> impl_;
45 };
46
48} // namespace ZenitUI
Per-application state: renderer, platform, pointer, focus, portals.
Abstract windowing, timing, input, and clipboard backend.
Definition UIContext.hpp:383
PointerState pointer() override
Return the current pointer position (logical pixels), scroll wheel delta, and button states.
double time() override
Return a monotonic clock timestamp in seconds.
void setTextInputRect(Rect inputRect, float cursorXOffset=0.0f) override
Inform the OS IME of the active text-input rect and caret offset (in logical window coordinates) so c...
float dpiScale() override
Return the physical-to-logical DPI scale factor (e.g.
std::string getClipboardText() override
Read UTF-8 text from the operating system clipboard (empty string if unavailable).
Vec2 viewportSize() override
Return the current window/surface dimensions in logical pixels.
void setClipboardText(const std::string &text) override
Copy UTF-8 text to the operating system clipboard.
InputEvents pollInputEvents() override
Drain and return keyboard events queued since the previous frame.
EdgeInsets safeArea() override
Return screen safe-area insets in logical pixels (notches, rounded corners, system bars).
ModifierState modifiers() override
Return the current state of modifier keys (shift, ctrl, alt, super).
void setCursor(CursorShape cursor) override
Request the OS/windowing system to display the given cursor shape.
CursorShape
Standard OS cursor shapes requested via ZStyle cursor: and IPlatform::setCursor.
Definition UIEnums.hpp:61
Four-sided edge inset (used for padding, margin, borders).
Definition CoreTypes.hpp:62
One frame's worth of keyboard input.
Definition CoreTypes.hpp:437
Keyboard modifier snapshot.
Definition CoreTypes.hpp:390
Pointer position, wheel delta, and per-button state for one frame.
Definition CoreTypes.hpp:378
Axis-aligned rectangle in screen coordinates.
Definition CoreTypes.hpp:46
2D vector with component-wise arithmetic.
Definition CoreTypes.hpp:25