16#include "SDL3Platform.hpp"
17#include "SDL3Renderer.hpp"
18#include "SDL3AssetProvider.hpp"
24struct SDL_GLContextState;
25using SDL_GLContext = SDL_GLContextState *;
42 SDL3Backend() =
default;
43 ~SDL3Backend()
override {
shutdown(); }
45 SDL3Backend(
const SDL3Backend &) =
delete;
46 SDL3Backend &operator=(
const SDL3Backend &) =
delete;
51 float deltaTime()
const override {
return deltaTime_; }
54 std::string_view
name()
const override {
return "SDL3 + OpenGL 3.3"; }
61 SDL_Window *window_{
nullptr};
62 SDL_GLContext glContext_{
nullptr};
63 std::unique_ptr<SDL3Platform> platform_;
64 std::unique_ptr<SDL3Renderer> renderer_;
65 std::unique_ptr<SDL3AssetProvider> assets_;
66 uint64_t lastTicksNs_{0};
67 float deltaTime_{1.0f / 60.0f};
69 bool initialized_{
false};
Unified host interface (IBackend) for backend-agnostic ZenitUI apps.
Abstract name-based lookup and runtime lifecycle for textures and shaders.
Definition UIContext.hpp:449
Unified window, frame-loop, and subsystem host for interchangeable backends.
Definition Backend.hpp:49
Abstract 2D rendering backend.
Definition UIContext.hpp:106
void beginDraw(Color clearColor) override
Begin presenting a frame and clear the main framebuffer to clearColor.
std::string_view name() const override
Short human-readable backend identifier (e.g.
Definition SDL3Backend.hpp:54
IAssetProvider & assets() override
Access the underlying asset provider.
Definition SDL3Backend.hpp:58
float deltaTime() const override
Return the elapsed time in seconds since the previous pollFrame().
Definition SDL3Backend.hpp:51
bool pollFrame() override
Pump OS events for the next frame; returns false when the window should close.
void endDraw() override
Finish the frame and swap buffers.
IPlatform & platform() override
Access the underlying platform adapter.
Definition SDL3Backend.hpp:56
bool init(const WindowConfig &config) override
Create the window and graphics context, and bind subsystems to UIContext.
void shutdown() override
Release pooled targets, unbind UIContext, and tear down the window/context.
IRenderer & renderer() override
Access the underlying renderer adapter.
Definition SDL3Backend.hpp:57
8-bit-per-channel RGBA color, non-premultiplied.
Definition CoreTypes.hpp:78
Backend-agnostic window and graphics-context creation parameters.
Definition Backend.hpp:31