yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::gfx::RendererFactory Class Reference

Factory class for creating IRenderer instances. More...

#include <renderer_factory.h>

Static Public Member Functions

static std::unique_ptr< IRendererCreate (RendererBackendType type=RendererBackendType::kDefault)
 Create a renderer instance with the specified backend type.
 
static bool IsBackendAvailable (RendererBackendType type)
 Check if a specific backend type is available in this build.
 
static const char * GetBackendName (RendererBackendType type)
 Get a string name for a backend type.
 
static RendererBackendType GetDefaultBackendType ()
 Get the default backend type for this build.
 

Detailed Description

Factory class for creating IRenderer instances.

This factory provides a centralized way to create renderer instances based on the desired backend type. It abstracts away the concrete renderer implementations, allowing the application to be configured for different SDL versions at compile time or runtime.

Usage:

// Create with default backend (based on build configuration)
auto renderer = RendererFactory::Create();
// Create with specific backend
static std::unique_ptr< IRenderer > Create(RendererBackendType type=RendererBackendType::kDefault)
Create a renderer instance with the specified backend type.
@ SDL2
SDL2 renderer backend.

Definition at line 45 of file renderer_factory.h.

Member Function Documentation

◆ Create()

static std::unique_ptr< IRenderer > yaze::gfx::RendererFactory::Create ( RendererBackendType type = RendererBackendType::kDefault)
inlinestatic

Create a renderer instance with the specified backend type.

Parameters
typeThe desired backend type. If kDefault or kAutoDetect, the factory will use the backend based on build configuration (SDL3 if YAZE_USE_SDL3 is defined, SDL2 otherwise).
Returns
A unique pointer to the created IRenderer instance. Returns nullptr if the requested backend is not available.

Definition at line 56 of file renderer_factory.h.

References yaze::gfx::kAutoDetect, yaze::gfx::kDefault, yaze::gfx::SDL2, and yaze::gfx::SDL3.

Referenced by main(), and yaze::Controller::OnEntry().

◆ IsBackendAvailable()

static bool yaze::gfx::RendererFactory::IsBackendAvailable ( RendererBackendType type)
inlinestatic

Check if a specific backend type is available in this build.

Parameters
typeThe backend type to check.
Returns
true if the backend is available, false otherwise.

Definition at line 92 of file renderer_factory.h.

References yaze::gfx::kAutoDetect, yaze::gfx::kDefault, yaze::gfx::SDL2, and yaze::gfx::SDL3.

◆ GetBackendName()

static const char * yaze::gfx::RendererFactory::GetBackendName ( RendererBackendType type)
inlinestatic

Get a string name for a backend type.

Parameters
typeThe backend type.
Returns
A human-readable name for the backend.

Definition at line 121 of file renderer_factory.h.

References yaze::gfx::kAutoDetect, yaze::gfx::kDefault, yaze::gfx::SDL2, and yaze::gfx::SDL3.

◆ GetDefaultBackendType()

static RendererBackendType yaze::gfx::RendererFactory::GetDefaultBackendType ( )
inlinestatic

Get the default backend type for this build.

Returns
The default backend type based on build configuration.

Definition at line 141 of file renderer_factory.h.

References yaze::gfx::SDL2, and yaze::gfx::SDL3.


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