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 
27 
28 unique_ptr<VideoSystem> createVideoSystem(Reactor& reactor)
29 {
30  Display& display = reactor.getDisplay();
31  switch (display.getRenderSettings().getRenderer()) {
33  return std::make_unique<DummyVideoSystem>();
36  return std::make_unique<SDLVideoSystem>(
37  reactor, display.getCommandConsole());
38  default:
39  UNREACHABLE; return nullptr;
40  }
41 }
42 
43 unique_ptr<Renderer> createRenderer(VDP& vdp, Display& display)
44 {
45  switch (display.getRenderSettings().getRenderer()) {
47  return std::make_unique<DummyRenderer>();
50  return std::make_unique<PixelRenderer>(vdp, display);
51  default:
52  UNREACHABLE; return nullptr;
53  }
54 }
55 
56 unique_ptr<V9990Renderer> createV9990Renderer(V9990& vdp, Display& display)
57 {
58  switch (display.getRenderSettings().getRenderer()) {
60  return std::make_unique<V9990DummyRenderer>();
63  return std::make_unique<V9990PixelRenderer>(vdp);
64  default:
65  UNREACHABLE; return nullptr;
66  }
67 }
68 
69 #if COMPONENT_LASERDISC
70 unique_ptr<LDRenderer> createLDRenderer(LaserdiscPlayer& ld, Display& display)
71 {
72  switch (display.getRenderSettings().getRenderer()) {
74  return std::make_unique<LDDummyRenderer>();
77  return std::make_unique<LDPixelRenderer>(ld, display);
78  default:
79  UNREACHABLE; return nullptr;
80  }
81 }
82 #endif
83 
84 } // namespace openmsx::RendererFactory
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.
unique_ptr< LDRenderer > createLDRenderer(LaserdiscPlayer &ld, Display &display)
Create the Laserdisc Renderer.
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
Interface for renderer factories.
Display & getDisplay()
Definition: Reactor.hh:85
#define UNREACHABLE
Definition: unreachable.hh:38