ZenitUI
Retained-mode C++20 UI framework
Loading...
Searching...
No Matches
RaylibBackend.hpp
Go to the documentation of this file.
1#pragma once
2
3// @backend_name Raylib
4// @backend_target ZenitUI::RaylibBackend
5// @backend_role Reference desktop GPU backend (Raylib / rlgl)
6// @backend_features Effects, NestedTargets, TargetSubRect
7// @backend_classes ZenitUI::RaylibBackend ZenitUI::RaylibPlatform ZenitUI::RaylibRenderer ZenitUI::RaylibAssetProvider
8
14
15#include "Backend.hpp"
16#include "RaylibPlatform.hpp"
17#include "RaylibRenderer.hpp"
18#include "RaylibAssetProvider.hpp"
19
20#include <memory>
21
22namespace ZenitUI
23{
27
33 class RaylibBackend final : public IBackend
34 {
35 public:
36 RaylibBackend() = default;
37 ~RaylibBackend() override { shutdown(); }
38
39 RaylibBackend(const RaylibBackend &) = delete;
40 RaylibBackend &operator=(const RaylibBackend &) = delete;
41
42 bool init(const WindowConfig &config) override;
43 void shutdown() override;
44 bool pollFrame() override;
45 float deltaTime() const override;
46 void beginDraw(Color clearColor) override;
47 void endDraw() override;
48 std::string_view name() const override { return "Raylib"; }
49
50 IPlatform &platform() override { return *platform_; }
51 IRenderer &renderer() override { return *renderer_; }
52 IAssetProvider &assets() override { return *assets_; }
53
54 private:
55 std::unique_ptr<RaylibPlatform> platform_;
56 std::unique_ptr<RaylibRenderer> renderer_;
57 std::unique_ptr<RaylibAssetProvider> assets_;
58 bool initialized_{false};
59 };
60
62} // namespace ZenitUI
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 windowing, timing, input, and clipboard backend.
Definition UIContext.hpp:383
Abstract 2D rendering backend.
Definition UIContext.hpp:106
float deltaTime() const override
Return the elapsed time in seconds since the previous pollFrame().
void endDraw() override
Finish the frame and swap buffers.
std::string_view name() const override
Short human-readable backend identifier (e.g.
Definition RaylibBackend.hpp:48
IAssetProvider & assets() override
Access the underlying asset provider.
Definition RaylibBackend.hpp:52
bool init(const WindowConfig &config) override
Create the window and graphics context, and bind subsystems to UIContext.
void beginDraw(Color clearColor) override
Begin presenting a frame and clear the main framebuffer to clearColor.
IPlatform & platform() override
Access the underlying platform adapter.
Definition RaylibBackend.hpp:50
void shutdown() override
Release pooled targets, unbind UIContext, and tear down the window/context.
bool pollFrame() override
Pump OS events for the next frame; returns false when the window should close.
IRenderer & renderer() override
Access the underlying renderer adapter.
Definition RaylibBackend.hpp:51
8-bit-per-channel RGBA color, non-premultiplied.
Definition CoreTypes.hpp:78
Backend-agnostic window and graphics-context creation parameters.
Definition Backend.hpp:31