yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
window_backend_factory.cc
Go to the documentation of this file.
1// window_backend_factory.cc - Window Backend Factory Implementation
2
4
6#include "util/log.h"
7
8#ifdef YAZE_USE_SDL3
10#endif
11
12namespace yaze {
13namespace platform {
14
15std::unique_ptr<IWindowBackend> WindowBackendFactory::Create(
16 WindowBackendType type) {
17 switch (type) {
19#ifndef YAZE_USE_SDL3
20 return std::make_unique<SDL2WindowBackend>();
21#else
22 LOG_WARN("WindowBackendFactory",
23 "SDL2 backend requested but built with SDL3, using SDL3");
24 return std::make_unique<SDL3WindowBackend>();
25#endif
26
28#ifdef YAZE_USE_SDL3
29 return std::make_unique<SDL3WindowBackend>();
30#else
31 LOG_WARN("WindowBackendFactory",
32 "SDL3 backend requested but not available, using SDL2");
33 return std::make_unique<SDL2WindowBackend>();
34#endif
35
37 default:
38 return Create(GetDefaultType());
39 }
40}
41
43#ifdef YAZE_USE_SDL3
45#else
47#endif
48}
49
51 switch (type) {
53#ifdef YAZE_USE_SDL3
54 return false; // Built with SDL3, SDL2 not available
55#else
56 return true;
57#endif
58
60#ifdef YAZE_USE_SDL3
61 return true;
62#else
63 return false; // SDL3 not built in
64#endif
65
67 return true; // Auto always available
68
69 default:
70 return false;
71 }
72}
73
74} // namespace platform
75} // namespace yaze
static WindowBackendType GetDefaultType()
Get the default backend type for this build.
static std::unique_ptr< IWindowBackend > Create(WindowBackendType type)
Create a window backend of the specified type.
static bool IsAvailable(WindowBackendType type)
Check if a backend type is available.
#define LOG_WARN(category, format,...)
Definition log.h:107
WindowBackendType
Backend type enumeration for factory.
Definition iwindow.h:272