ZenitUI
Retained-mode C++20 UI framework
Loading...
Searching...
No Matches
ZenitUI::Test::MockBackend Class Referencefinal

Headless IBackend host wrapping MockPlatform, MockRenderer, and MockAssetProvider. More...

#include <MockBackend.hpp>

Inheritance diagram for ZenitUI::Test::MockBackend:
[legend]

Public Member Functions

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.
bool pollFrame () override
 Pump OS events for the next frame; returns false when the window should close.
float deltaTime () const override
 Return the elapsed time in seconds since the previous pollFrame().
void beginDraw (Color clearColor) override
 Begin presenting a frame and clear the main framebuffer to clearColor.
void endDraw () override
 Finish the frame and swap buffers.
std::string_view name () const override
 Short human-readable backend identifier (e.g.
IPlatform & platform () override
 Access the underlying platform adapter.
IRenderer & renderer () override
 Access the underlying renderer adapter.
IAssetProvider & assets () override
 Access the underlying asset provider.
Public Member Functions inherited from ZenitUI::IBackend
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.

Public Attributes

MockPlatform mockPlatform
MockRenderer mockRenderer
MockAssetProvider mockAssets
float fixedDt {1.0f / 60.0f}
int maxFrames {1}

Additional Inherited Members

Protected Attributes inherited from ZenitUI::IBackend
UIContext * boundCtx_ {nullptr}

Detailed Description

Headless IBackend host wrapping MockPlatform, MockRenderer, and MockAssetProvider.

Member Function Documentation

◆ assets()

IAssetProvider & ZenitUI::Test::MockBackend::assets ( )
overridevirtual

Access the underlying asset provider.

Implements ZenitUI::IBackend.

◆ beginDraw()

void ZenitUI::Test::MockBackend::beginDraw ( Color clearColor)
overridevirtual

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

Implements ZenitUI::IBackend.

◆ deltaTime()

float ZenitUI::Test::MockBackend::deltaTime ( ) const
overridevirtual

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

Implements ZenitUI::IBackend.

◆ endDraw()

void ZenitUI::Test::MockBackend::endDraw ( )
overridevirtual

Finish the frame and swap buffers.

Implements ZenitUI::IBackend.

◆ init()

bool ZenitUI::Test::MockBackend::init ( const WindowConfig & config)
overridevirtual

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

Implements ZenitUI::IBackend.

◆ name()

std::string_view ZenitUI::Test::MockBackend::name ( ) const
overridevirtual

Short human-readable backend identifier (e.g.

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

Implements ZenitUI::IBackend.

◆ platform()

IPlatform & ZenitUI::Test::MockBackend::platform ( )
overridevirtual

Access the underlying platform adapter.

Implements ZenitUI::IBackend.

◆ pollFrame()

bool ZenitUI::Test::MockBackend::pollFrame ( )
overridevirtual

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

Implements ZenitUI::IBackend.

◆ renderer()

IRenderer & ZenitUI::Test::MockBackend::renderer ( )
overridevirtual

Access the underlying renderer adapter.

Implements ZenitUI::IBackend.

◆ shutdown()

void ZenitUI::Test::MockBackend::shutdown ( )
overridevirtual

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

Implements ZenitUI::IBackend.


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