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 
24 using std::unique_ptr;
25 
26 namespace openmsx {
27 namespace RendererFactory {
28 
29 unique_ptr<VideoSystem> createVideoSystem(Reactor& reactor)
30 {
31  Display& display = reactor.getDisplay();
32  switch (display.getRenderSettings().getRenderer()) {
34  return std::make_unique<DummyVideoSystem>();
39  return std::make_unique<SDLVideoSystem>(
40  reactor, display.getCommandConsole());
41  default:
42  UNREACHABLE; return nullptr;
43  }
44 }
45 
46 unique_ptr<Renderer> createRenderer(VDP& vdp, Display& display)
47 {
48  switch (display.getRenderSettings().getRenderer()) {
50  return std::make_unique<DummyRenderer>();
55  return std::make_unique<PixelRenderer>(vdp, display);
56  default:
57  UNREACHABLE; return nullptr;
58  }
59 }
60 
61 unique_ptr<V9990Renderer> createV9990Renderer(V9990& vdp, Display& display)
62 {
63  switch (display.getRenderSettings().getRenderer()) {
65  return std::make_unique<V9990DummyRenderer>();
70  return std::make_unique<V9990PixelRenderer>(vdp);
71  default:
72  UNREACHABLE; return nullptr;
73  }
74 }
75 
76 #if COMPONENT_LASERDISC
77 unique_ptr<LDRenderer> createLDRenderer(LaserdiscPlayer& ld, Display& display)
78 {
79  switch (display.getRenderSettings().getRenderer()) {
81  return std::make_unique<LDDummyRenderer>();
86  return std::make_unique<LDPixelRenderer>(ld, display);
87  default:
88  UNREACHABLE; return nullptr;
89  }
90 }
91 #endif
92 
93 } // namespace RendererFactory
94 } // namespace openmsx
Implementation of the Yamaha V9990 VDP as used in the GFX9000 cartridge by Sunrise.
Definition: V9990.hh:29
Contains the main loop of openMSX.
Definition: Reactor.hh:66
Represents the output window/screen of openMSX.
Definition: Display.hh:31
CommandConsole & getCommandConsole()
Definition: Display.hh:46
RenderSettings & getRenderSettings()
Definition: Display.hh:44
unique_ptr< VideoSystem > createVideoSystem(Reactor &reactor)
Create the video system required by the current renderer setting.
unique_ptr< Renderer > createRenderer(VDP &vdp, Display &display)
Create the Renderer selected by the current renderer setting.
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
unique_ptr< V9990Renderer > createV9990Renderer(V9990 &vdp, Display &display)
Create the V9990 Renderer selected by the current renderer setting.
Unified implementation of MSX Video Display Processors (VDPs).
Definition: VDP.hh:61
RendererID getRenderer() const
Display & getDisplay()
Definition: Reactor.hh:85
#define UNREACHABLE
Definition: unreachable.hh:38