openMSX
RendererFactory.cc
Go to the documentation of this file.
1#include "RendererFactory.hh"
2#include "RenderSettings.hh"
3#include "Reactor.hh"
4#include "Display.hh"
5#include "unreachable.hh"
6#include <memory>
7
8// Video systems:
9#include "components.hh"
10#include "DummyVideoSystem.hh"
11#include "SDLVideoSystem.hh"
12
13// Renderers:
14#include "DummyRenderer.hh"
15#include "PixelRenderer.hh"
16#include "V9990DummyRenderer.hh"
17#include "V9990PixelRenderer.hh"
18
19#if COMPONENT_LASERDISC
20#include "LDDummyRenderer.hh"
21#include "LDPixelRenderer.hh"
22#endif
23
25
26std::unique_ptr<VideoSystem> createVideoSystem(Reactor& reactor)
27{
28 Display& display = reactor.getDisplay();
29 switch (display.getRenderSettings().getRenderer()) {
31 return std::make_unique<DummyVideoSystem>();
33 return std::make_unique<SDLVideoSystem>(reactor);
34 default:
35 UNREACHABLE; return nullptr;
36 }
37}
38
39std::unique_ptr<Renderer> createRenderer(VDP& vdp, Display& display)
40{
41 switch (display.getRenderSettings().getRenderer()) {
43 return std::make_unique<DummyRenderer>();
45 return std::make_unique<PixelRenderer>(vdp, display);
46 default:
47 UNREACHABLE; return nullptr;
48 }
49}
50
51std::unique_ptr<V9990Renderer> createV9990Renderer(V9990& vdp, Display& display)
52{
53 switch (display.getRenderSettings().getRenderer()) {
55 return std::make_unique<V9990DummyRenderer>();
57 return std::make_unique<V9990PixelRenderer>(vdp);
58 default:
59 UNREACHABLE; return nullptr;
60 }
61}
62
63#if COMPONENT_LASERDISC
64std::unique_ptr<LDRenderer> createLDRenderer(LaserdiscPlayer& ld, Display& display)
65{
66 switch (display.getRenderSettings().getRenderer()) {
68 return std::make_unique<LDDummyRenderer>();
70 return std::make_unique<LDPixelRenderer>(ld, display);
71 default:
72 UNREACHABLE; return nullptr;
73 }
74}
75#endif
76
77} // namespace openmsx::RendererFactory
Represents the output window/screen of openMSX.
Definition Display.hh:32
RenderSettings & getRenderSettings()
Definition Display.hh:43
Contains the main loop of openMSX.
Definition Reactor.hh:72
Display & getDisplay()
Definition Reactor.hh:90
RendererID getRenderer() const
Implementation of the Yamaha V9990 VDP as used in the GFX9000 cartridge by Sunrise.
Definition V9990.hh:35
Unified implementation of MSX Video Display Processors (VDPs).
Definition VDP.hh:64
Interface for renderer factories.
std::unique_ptr< VideoSystem > createVideoSystem(Reactor &reactor)
Create the video system required by the current renderer setting.
std::unique_ptr< V9990Renderer > createV9990Renderer(V9990 &vdp, Display &display)
Create the V9990 Renderer selected by the current renderer setting.
std::unique_ptr< Renderer > createRenderer(VDP &vdp, Display &display)
Create the Renderer selected by the current renderer setting.
#define UNREACHABLE