openMSX
VideoLayer.hh
Go to the documentation of this file.
1 #ifndef VIDEOLAYER_HH
2 #define VIDEOLAYER_HH
3 
4 #include "VideoSourceSetting.hh"
5 #include "Layer.hh"
6 #include "Observer.hh"
7 #include "MSXEventListener.hh"
8 #include <string>
9 
10 namespace openmsx {
11 
12 class MSXMotherBoard;
13 class Display;
14 class Setting;
15 class BooleanSetting;
16 
17 class VideoLayer : public Layer, protected Observer<Setting>
18  , private MSXEventListener
19 {
20 public:
21  VideoLayer(const VideoLayer&) = delete;
22  VideoLayer& operator=(const VideoLayer&) = delete;
23 
28  [[nodiscard]] int getVideoSource() const;
29  [[nodiscard]] int getVideoSourceSetting() const;
30 
34  virtual void takeRawScreenShot(
35  unsigned height, const std::string& filename) = 0;
36 
37  // We used to test whether a Layer is active by looking at the
38  // Z-coordinate (Z_MSX_ACTIVE vs Z_MSX_PASSIVE). Though in case of
39  // Video9000 it's possible the Video9000 layer is selected, but we
40  // still need to render this layer (the v99x8 or v9990 layer).
42  void setVideo9000Active(int video9000Source_, Video9000Active active) {
43  video9000Source = video9000Source_;
44  activeVideo9000 = active;
45  }
46  [[nodiscard]] bool needRender() const;
47  [[nodiscard]] bool needRecord() const;
48 
49 protected:
50  VideoLayer(MSXMotherBoard& motherBoard,
51  const std::string& videoSource);
52  ~VideoLayer() override;
53 
54  // Observer<Setting> interface:
55  void update(const Setting& setting) noexcept override;
56 
57 private:
59  void calcZ();
61  void calcCoverage();
62 
63  // MSXEventListener
64  void signalMSXEvent(const std::shared_ptr<const Event>& event,
65  EmuTime::param time) noexcept override;
66 
67 private:
69  MSXMotherBoard& motherBoard;
71  Display& display;
73  VideoSourceSetting& videoSourceSetting;
75  VideoSourceActivator videoSourceActivator;
77  BooleanSetting& powerSetting;
78 
80  int video9000Source;
82  Video9000Active activeVideo9000;
83 };
84 
85 } // namespace openmsx
86 
87 #endif
Represents the output window/screen of openMSX.
Definition: Display.hh:33
Interface for display layers.
Definition: Layer.hh:12
Generic Gang-of-Four Observer class, templatized edition.
Definition: Observer.hh:10
int getVideoSource() const
Returns the ID for this videolayer.
Definition: VideoLayer.cc:41
bool needRecord() const
Definition: VideoLayer.cc:93
virtual void takeRawScreenShot(unsigned height, const std::string &filename)=0
Create a raw (=non-postprocessed) screenshot.
VideoLayer & operator=(const VideoLayer &)=delete
void setVideo9000Active(int video9000Source_, Video9000Active active)
Definition: VideoLayer.hh:42
bool needRender() const
Definition: VideoLayer.cc:83
int getVideoSourceSetting() const
Definition: VideoLayer.cc:45
void update(const Setting &setting) noexcept override
Definition: VideoLayer.cc:50
~VideoLayer() override
Definition: VideoLayer.cc:32
VideoLayer(const VideoLayer &)=delete
This file implemented 3 utility functions:
Definition: Autofire.cc:5
constexpr const char *const filename