Go to the documentation of this file.
4 #include "VideoSystem.hh"
5 #include "EventListener.hh"
6 #include "gl_vec.hh"
7 #include "Observer.hh"
8 #include "components.hh"
9 #include <memory>
11 namespace openmsx {
13 class Reactor;
14 class CommandConsole;
15 class Display;
16 class RenderSettings;
17 class SDLVisibleSurfaceBase;
18 class Layer;
19 class Setting;
21 class SDLVideoSystem final : public VideoSystem, private EventListener
22  , private Observer<Setting>
23 {
24 public:
28  explicit SDLVideoSystem(Reactor& reactor, CommandConsole& console);
32  ~SDLVideoSystem() override;
34  // VideoSystem interface:
35  [[nodiscard]] std::unique_ptr<Rasterizer> createRasterizer(VDP& vdp) override;
36  [[nodiscard]] std::unique_ptr<V9990Rasterizer> createV9990Rasterizer(
37  V9990& vdp) override;
39  std::unique_ptr<LDRasterizer> createLDRasterizer(
40  LaserdiscPlayer& ld) override;
41 #endif
42  [[nodiscard]] bool checkSettings() override;
43  void flush() override;
44  void takeScreenShot(const std::string& filename, bool withOsd) override;
45  void updateWindowTitle() override;
46  [[nodiscard]] gl::ivec2 getMouseCoord() override;
47  [[nodiscard]] OutputSurface* getOutputSurface() override;
48  void showCursor(bool show) override;
49  [[nodiscard]] bool getCursorEnabled() override;
50  [[nodiscard]] std::string getClipboardText() override;
51  void setClipboardText(zstring_view text) override;
52  void repaint() override;
54 private:
55  // EventListener
56  int signalEvent(const std::shared_ptr<const Event>& event) noexcept override;
57  // Observer
58  void update(const Setting& subject) noexcept override;
60  [[nodiscard]] gl::ivec2 getWindowSize();
61  void resize();
63 private:
64  Reactor& reactor;
65  Display& display;
66  RenderSettings& renderSettings;
67  std::unique_ptr<SDLVisibleSurfaceBase> screen;
68  std::unique_ptr<Layer> consoleLayer;
69  std::unique_ptr<Layer> snowLayer;
70  std::unique_ptr<Layer> iconLayer;
71  std::unique_ptr<Layer> osdGuiLayer;
72 };
74 } // namespace openmsx
76 #endif
Represents the output window/screen of openMSX.
Definition: Display.hh:33
Generic Gang-of-Four Observer class, templatized edition.
Definition: Observer.hh:10
A frame buffer where pixels can be written to.
Contains the main loop of openMSX.
Definition: Reactor.hh:67
Class containing all settings for renderers.
bool getCursorEnabled() override
SDLVideoSystem(Reactor &reactor, CommandConsole &console)
Activates this video system.
void repaint() override
Requests a repaint of the output surface.
void setClipboardText(zstring_view text) override
void showCursor(bool show) override
gl::ivec2 getMouseCoord() override
Returns the current mouse pointer coordinates.
std::unique_ptr< V9990Rasterizer > createV9990Rasterizer(V9990 &vdp) override
Create the V9990 rasterizer selected by the current renderer setting.
~SDLVideoSystem() override
Deactivates this video system.
bool checkSettings() override
Requests that this renderer checks its settings against the current RenderSettings.
OutputSurface * getOutputSurface() override
void takeScreenShot(const std::string &filename, bool withOsd) override
Take a screenshot.
std::unique_ptr< LDRasterizer > createLDRasterizer(LaserdiscPlayer &ld) override
void updateWindowTitle() override
Called when the window title string has changed.
std::string getClipboardText() override
void flush() override
Finish pending drawing operations and make them visible to the user.
std::unique_ptr< Rasterizer > createRasterizer(VDP &vdp) override
Create the rasterizer selected by the current renderer setting.
Implementation of the Yamaha V9990 VDP as used in the GFX9000 cartridge by Sunrise.
Definition: V9990.hh:31
Unified implementation of MSX Video Display Processors (VDPs).
Definition: VDP.hh:63
Video back-end system.
Definition: VideoSystem.hh:23
Like std::string_view, but with the extra guarantee that it refers to a zero-terminated string.
Definition: zstring_view.hh:21
This file implemented 3 utility functions:
constexpr const char *const filename