OXYGENHUB
◆ main openmsx / src / video / SDLVideoSystem.hh
2.0 KiB · C++ · last changed chore(): initial commit 1 month ago source blame history raw
e8555c89 Andy McCall 1
#ifndef SDLVIDEOSYSTEM_HH
2
#define SDLVIDEOSYSTEM_HH
3
4
#include "VideoSystem.hh"
5
#include "gl_vec.hh"
6
7
#include "EventListener.hh"
8
9
#include "Observer.hh"
10
11
#include "components.hh"
12
13
#include <memory>
14
15
namespace openmsx {
16
17
class Display;
18
class Layer;
19
class Reactor;
20
class RenderSettings;
21
class Setting;
22
class VisibleSurface;
23
24
class SDLVideoSystem final : public VideoSystem, private EventListener
25
                           , private Observer<Setting>
26
{
27
public:
28
	/** Activates this video system.
29
	  * @throw InitException If initialisation fails.
30
	  */
31
	explicit SDLVideoSystem(Reactor& reactor);
32
33
	/** Deactivates this video system.
34
	  */
35
	~SDLVideoSystem() override;
36
37
	// VideoSystem interface:
38
	[[nodiscard]] std::unique_ptr<Rasterizer> createRasterizer(VDP& vdp) override;
39
	[[nodiscard]] std::unique_ptr<V9990Rasterizer> createV9990Rasterizer(
40
		V9990& vdp) override;
41
#if COMPONENT_LASERDISC
42
	std::unique_ptr<LDRasterizer> createLDRasterizer(
43
		LaserdiscPlayer& ld) override;
44
#endif
45
	void flush() override;
46
	void takeScreenShot(const std::string& filename, bool withOsd) override;
47
	void updateWindowTitle() override;
48
	[[nodiscard]] std::optional<gl::ivec2> getMouseCoord() override;
49
	[[nodiscard]] std::optional<gl::vec2> getMsxPixelSize() override;
50
	[[nodiscard]] OutputSurface* getOutputSurface() override;
51
	void showCursor(bool show) override;
52
	[[nodiscard]] bool getCursorEnabled() override;
53
	[[nodiscard]] std::string getClipboardText() override;
54
	void setClipboardText(zstring_view text) override;
55
	[[nodiscard]] std::optional<gl::ivec2> getWindowPosition() override;
56
	void setWindowPosition(gl::ivec2 pos) override;
57
	void repaint() override;
58
59
private:
60
	// EventListener
61
	bool signalEvent(const Event& event) override;
62
	// Observer
63
	void update(const Setting& subject) noexcept override;
64
65
private:
66
	Reactor& reactor;
67
	Display& display;
68
	RenderSettings& renderSettings;
69
	std::unique_ptr<VisibleSurface> screen;
70
	std::unique_ptr<Layer> snowLayer;
71
	std::unique_ptr<Layer> iconLayer;
72
	std::unique_ptr<Layer> osdGuiLayer;
73
	std::unique_ptr<Layer> imGuiLayer;
74
};
75
76
} // namespace openmsx
77
78
#endif