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>();
34 return std::make_unique<SDLVideoSystem>(
35 reactor, display.getCommandConsole());
36 default:
37 UNREACHABLE; return nullptr;
38 }
39}
40
41std::unique_ptr<Renderer> createRenderer(VDP& vdp, Display& display)
42{
43 switch (display.getRenderSettings().getRenderer()) {
45 return std::make_unique<DummyRenderer>();
48 return std::make_unique<PixelRenderer>(vdp, display);
49 default:
50 UNREACHABLE; return nullptr;
51 }
52}
53
54std::unique_ptr<V9990Renderer> createV9990Renderer(V9990& vdp, Display& display)
55{
56 switch (display.getRenderSettings().getRenderer()) {
58 return std::make_unique<V9990DummyRenderer>();
61 return std::make_unique<V9990PixelRenderer>(vdp);
62 default:
63 UNREACHABLE; return nullptr;
64 }
65}
66
67#if COMPONENT_LASERDISC
68std::unique_ptr<LDRenderer> createLDRenderer(LaserdiscPlayer& ld, Display& display)
69{
70 switch (display.getRenderSettings().getRenderer()) {
72 return std::make_unique<LDDummyRenderer>();
75 return std::make_unique<LDPixelRenderer>(ld, display);
76 default:
77 UNREACHABLE; return nullptr;
78 }
79}
80#endif
81
82} // namespace openmsx::RendererFactory
Represents the output window/screen of openMSX.
Definition: Display.hh:33
RenderSettings & getRenderSettings()
Definition: Display.hh:44
CommandConsole & getCommandConsole()
Definition: Display.hh:46
Contains the main loop of openMSX.
Definition: Reactor.hh:68
Display & getDisplay()
Definition: Reactor.hh:86
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< LDRenderer > createLDRenderer(LaserdiscPlayer &ld, Display &display)
Create the Laserdisc Renderer.
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
Definition: unreachable.hh:38