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
Display.hh
openmsx::RendererFactory::createVideoSystem
unique_ptr< VideoSystem > createVideoSystem(Reactor &reactor)
Create the video system required by the current renderer setting.
Definition: RendererFactory.cc:28
openmsx::VDP
Unified implementation of MSX Video Display Processors (VDPs).
Definition: VDP.hh:61
openmsx::Reactor::getDisplay
Display & getDisplay()
Definition: Reactor.hh:85
openmsx::RendererFactory::createV9990Renderer
unique_ptr< V9990Renderer > createV9990Renderer(V9990 &vdp, Display &display)
Create the V9990 Renderer selected by the current renderer setting.
Definition: RendererFactory.cc:56
openmsx::RendererFactory::createRenderer
unique_ptr< Renderer > createRenderer(VDP &vdp, Display &display)
Create the Renderer selected by the current renderer setting.
Definition: RendererFactory.cc:43
openmsx::RendererFactory
Interface for renderer factories.
Definition: RendererFactory.cc:26
RendererFactory.hh
openmsx::LaserdiscPlayer
Definition: LaserdiscPlayer.hh:25
openmsx::RenderSettings::SDLGL_PP
Definition: RenderSettings.hh:27
V9990DummyRenderer.hh
openmsx::Reactor
Contains the main loop of openMSX.
Definition: Reactor.hh:66
Reactor.hh
UNREACHABLE
#define UNREACHABLE
Definition: unreachable.hh:38
RenderSettings.hh
V9990PixelRenderer.hh
openmsx::RenderSettings::getRenderer
RendererID getRenderer() const
Definition: RenderSettings.hh:111
LDDummyRenderer.hh
components.hh
openmsx::RenderSettings::SDL
Definition: RenderSettings.hh:27
openmsx::RendererFactory::createLDRenderer
unique_ptr< LDRenderer > createLDRenderer(LaserdiscPlayer &ld, Display &display)
Create the Laserdisc Renderer.
Definition: RendererFactory.cc:70
openmsx::Display
Represents the output window/screen of openMSX.
Definition: Display.hh:31
openmsx::Display::getRenderSettings
RenderSettings & getRenderSettings()
Definition: Display.hh:44
DummyRenderer.hh
openmsx::Display::getCommandConsole
CommandConsole & getCommandConsole()
Definition: Display.hh:46
PixelRenderer.hh
unreachable.hh
openmsx::RenderSettings::DUMMY
Definition: RenderSettings.hh:27
LDPixelRenderer.hh
SDLVideoSystem.hh
DummyVideoSystem.hh
openmsx::V9990
Implementation of the Yamaha V9990 VDP as used in the GFX9000 cartridge by Sunrise.
Definition: V9990.hh:29