ZenitUI
Retained-mode C++20 UI framework
Loading...
Searching...
No Matches
ZenitUI::IBackend Class Referenceabstract

Unified window, frame-loop, and subsystem host for interchangeable backends. More...

#include <Backend.hpp>

Inheritance diagram for ZenitUI::IBackend:
[legend]

Public Member Functions

virtual bool init (const WindowConfig &config)=0
 Create the window and graphics context, and bind subsystems to UIContext.
virtual void shutdown ()=0
 Release pooled targets, unbind UIContext, and tear down the window/context.
virtual bool pollFrame ()=0
 Pump OS events for the next frame; returns false when the window should close.
virtual float deltaTime () const =0
 Return the elapsed time in seconds since the previous pollFrame().
virtual void beginDraw (Color clearColor)=0
 Begin presenting a frame and clear the main framebuffer to clearColor.
virtual void endDraw ()=0
 Finish the frame and swap buffers.
virtual std::string_view name () const =0
 Short human-readable backend identifier (e.g.
virtual IPlatform & platform ()=0
 Access the underlying platform adapter.
virtual IRenderer & renderer ()=0
 Access the underlying renderer adapter.
virtual IAssetProvider & assets ()=0
 Access the underlying asset provider.
void bindTo (UIContext &ctx)
 Attach this backend's adapters to ctx, unbinding any previous context.
void unbind ()
 Flush pooled targets and detach this backend from its bound context.
UIContext * boundContext () const
 Return the currently bound UIContext, or nullptr if unbound.
bool initAndBind (const WindowConfig &config, UIContext &ctx)
 Initialize the backend and bind its adapters to ctx in one step.

Protected Attributes

UIContext * boundCtx_ {nullptr}

Detailed Description

Member Function Documentation

◆ assets()

virtual IAssetProvider & ZenitUI::IBackend::assets ( )
pure virtual

Access the underlying asset provider.

Implemented in ZenitUI::RaylibBackend, ZenitUI::SDL3Backend, and ZenitUI::Test::MockBackend.

Examples
14_desktop_workspace/main.cpp.

◆ beginDraw()

virtual void ZenitUI::IBackend::beginDraw ( Color clearColor)
pure virtual

Begin presenting a frame and clear the main framebuffer to clearColor.

Implemented in ZenitUI::RaylibBackend, ZenitUI::SDL3Backend, and ZenitUI::Test::MockBackend.

◆ deltaTime()

virtual float ZenitUI::IBackend::deltaTime ( ) const
pure virtual

Return the elapsed time in seconds since the previous pollFrame().

Implemented in ZenitUI::RaylibBackend, ZenitUI::SDL3Backend, and ZenitUI::Test::MockBackend.

◆ endDraw()

virtual void ZenitUI::IBackend::endDraw ( )
pure virtual

Finish the frame and swap buffers.

Implemented in ZenitUI::RaylibBackend, ZenitUI::SDL3Backend, and ZenitUI::Test::MockBackend.

◆ init()

virtual bool ZenitUI::IBackend::init ( const WindowConfig & config)
pure virtual

Create the window and graphics context, and bind subsystems to UIContext.

Implemented in ZenitUI::RaylibBackend, ZenitUI::SDL3Backend, and ZenitUI::Test::MockBackend.

◆ name()

virtual std::string_view ZenitUI::IBackend::name ( ) const
pure virtual

Short human-readable backend identifier (e.g.

"Raylib", "SDL3 + OpenGL 3.3").

Implemented in ZenitUI::RaylibBackend, ZenitUI::SDL3Backend, and ZenitUI::Test::MockBackend.

Examples
01_hello_markup/main.cpp, 02_layout_flex/main.cpp, and 13_i18n_rtl/main.cpp.

◆ platform()

virtual IPlatform & ZenitUI::IBackend::platform ( )
pure virtual

Access the underlying platform adapter.

Implemented in ZenitUI::RaylibBackend, ZenitUI::SDL3Backend, and ZenitUI::Test::MockBackend.

◆ pollFrame()

virtual bool ZenitUI::IBackend::pollFrame ( )
pure virtual

Pump OS events for the next frame; returns false when the window should close.

Implemented in ZenitUI::RaylibBackend, ZenitUI::SDL3Backend, and ZenitUI::Test::MockBackend.

◆ renderer()

virtual IRenderer & ZenitUI::IBackend::renderer ( )
pure virtual

Access the underlying renderer adapter.

Implemented in ZenitUI::RaylibBackend, ZenitUI::SDL3Backend, and ZenitUI::Test::MockBackend.

◆ shutdown()

virtual void ZenitUI::IBackend::shutdown ( )
pure virtual

Release pooled targets, unbind UIContext, and tear down the window/context.

Implemented in ZenitUI::RaylibBackend, ZenitUI::SDL3Backend, and ZenitUI::Test::MockBackend.


The documentation for this class was generated from the following file: