yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
renderer_factory.h
Go to the documentation of this file.
1#ifndef YAZE_APP_GFX_BACKEND_RENDERER_FACTORY_H_
2#define YAZE_APP_GFX_BACKEND_RENDERER_FACTORY_H_
3
4#include <memory>
5
8
9#ifdef YAZE_USE_SDL3
11#endif
12
13namespace yaze {
14namespace gfx {
15
21 SDL2,
22 SDL3,
23 kDefault,
25};
26
46 public:
56 static std::unique_ptr<IRenderer> Create(
58 switch (type) {
60#ifndef YAZE_USE_SDL3
61 return std::make_unique<SDL2Renderer>();
62#else
63 return nullptr;
64#endif
65
67#ifdef YAZE_USE_SDL3
68 return std::make_unique<SDL3Renderer>();
69#else
70 // SDL3 not available in this build, fall back to SDL2
71 return std::make_unique<SDL2Renderer>();
72#endif
73
76 default:
77 // Use the default backend based on build configuration
78#ifdef YAZE_USE_SDL3
79 return std::make_unique<SDL3Renderer>();
80#else
81 return std::make_unique<SDL2Renderer>();
82#endif
83 }
84 }
85
93 switch (type) {
95 // SDL2 is always available (base requirement)
96 return true;
97
99#ifdef YAZE_USE_SDL3
100 return true;
101#else
102 return false;
103#endif
104
107 // Default/auto-detect is always available
108 return true;
109
110 default:
111 return false;
112 }
113 }
114
121 static const char* GetBackendName(RendererBackendType type) {
122 switch (type) {
124 return "SDL2";
126 return "SDL3";
128 return "Default";
130 return "AutoDetect";
131 default:
132 return "Unknown";
133 }
134 }
135
142#ifdef YAZE_USE_SDL3
144#else
146#endif
147 }
148};
149
150} // namespace gfx
151} // namespace yaze
152
153#endif // YAZE_APP_GFX_BACKEND_RENDERER_FACTORY_H_
Factory class for creating IRenderer instances.
static RendererBackendType GetDefaultBackendType()
Get the default backend type for this build.
static std::unique_ptr< IRenderer > Create(RendererBackendType type=RendererBackendType::kDefault)
Create a renderer instance with the specified backend type.
static const char * GetBackendName(RendererBackendType type)
Get a string name for a backend type.
static bool IsBackendAvailable(RendererBackendType type)
Check if a specific backend type is available in this build.
RendererBackendType
Enumeration of available rendering backend types.
@ SDL3
SDL3 renderer backend.
@ SDL2
SDL2 renderer backend.
@ kAutoDetect
Automatically select the best available backend.
@ kDefault
Use the default backend based on build configuration.