openMSX
VisibleSurface.hh
Go to the documentation of this file.
1 #ifndef VISIBLESURFACE_HH
2 #define VISIBLESURFACE_HH
3 
4 #include "Observer.hh"
5 #include "EventListener.hh"
6 #include "RTSchedulable.hh"
7 #include <memory>
8 
9 namespace openmsx {
10 
11 class Layer;
12 class OutputSurface;
13 class Reactor;
14 class CommandConsole;
15 class EventDistributor;
16 class InputEventGenerator;
17 class Setting;
18 class Display;
19 class OSDGUI;
20 class CliComm;
21 class VideoSystem;
22 
26 class VisibleSurface : public EventListener, private Observer<Setting>
27  , private RTSchedulable
28 {
29 public:
30  virtual ~VisibleSurface();
31  virtual void updateWindowTitle() = 0;
32  virtual bool setFullScreen(bool fullscreen) = 0;
33 
38  virtual void finish() = 0;
39 
40  [[nodiscard]] virtual std::unique_ptr<Layer> createSnowLayer() = 0;
41  [[nodiscard]] virtual std::unique_ptr<Layer> createConsoleLayer(
42  Reactor& reactor, CommandConsole& console) = 0;
43  [[nodiscard]] virtual std::unique_ptr<Layer> createOSDGUILayer(OSDGUI& gui) = 0;
44 
49  [[nodiscard]] virtual std::unique_ptr<OutputSurface> createOffScreenSurface() = 0;
50 
51  [[nodiscard]] CliComm& getCliComm() const { return cliComm; }
52  [[nodiscard]] Display& getDisplay() const { return display; }
53 
54 protected:
55  VisibleSurface(Display& display,
56  RTScheduler& rtScheduler,
57  EventDistributor& eventDistributor,
58  InputEventGenerator& inputEventGenerator,
59  CliComm& cliComm,
60  VideoSystem& videoSystem);
61 
62 private:
63  void updateCursor();
64 
65  // Observer
66  void update(const Setting& setting) noexcept override;
67  // EventListener
68  int signalEvent(const std::shared_ptr<const Event>& event) noexcept override;
69  // RTSchedulable
70  void executeRT() override;
71 
72 private:
73  Display& display;
74  EventDistributor& eventDistributor;
75  InputEventGenerator& inputEventGenerator;
76  CliComm& cliComm;
77  VideoSystem& videoSystem;
78  bool grab = false;
79 };
80 
81 } // namespace openmsx
82 
83 #endif
Represents the output window/screen of openMSX.
Definition: Display.hh:33
Generic Gang-of-Four Observer class, templatized edition.
Definition: Observer.hh:10
Contains the main loop of openMSX.
Definition: Reactor.hh:67
Video back-end system.
Definition: VideoSystem.hh:23
An OutputSurface which is visible to the user, such as a window or a full screen display.
virtual void updateWindowTitle()=0
Display & getDisplay() const
virtual std::unique_ptr< Layer > createOSDGUILayer(OSDGUI &gui)=0
virtual bool setFullScreen(bool fullscreen)=0
VisibleSurface(Display &display, RTScheduler &rtScheduler, EventDistributor &eventDistributor, InputEventGenerator &inputEventGenerator, CliComm &cliComm, VideoSystem &videoSystem)
virtual std::unique_ptr< Layer > createSnowLayer()=0
virtual std::unique_ptr< Layer > createConsoleLayer(Reactor &reactor, CommandConsole &console)=0
virtual void finish()=0
When a complete frame is finished, call this method.
virtual std::unique_ptr< OutputSurface > createOffScreenSurface()=0
Create an off-screen OutputSurface which has similar properties as this VisibleSurface.
CliComm & getCliComm() const
This file implemented 3 utility functions:
Definition: Autofire.cc:5