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  int getVideoSource() const;
29  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  bool needRender() const;
47  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) 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) override;
66 
68  MSXMotherBoard& motherBoard;
70  Display& display;
72  VideoSourceSetting& videoSourceSetting;
74  VideoSourceActivator videoSourceActivator;
76  BooleanSetting& powerSetting;
77 
79  int video9000Source;
81  Video9000Active activeVideo9000;
82 };
83 
84 } // namespace openmsx
85 
86 #endif
Represents the output window/screen of openMSX.
Definition: Display.hh:31
bool needRender() const
Definition: VideoLayer.cc:85
int getVideoSource() const
Returns the ID for this videolayer.
Definition: VideoLayer.cc:40
Interface for display layers.
Definition: Layer.hh:11
int getVideoSourceSetting() const
Definition: VideoLayer.cc:44
virtual void takeRawScreenShot(unsigned height, const std::string &filename)=0
Create a raw (=non-postprocessed) screenshot.
void update(const Setting &setting) override
Definition: VideoLayer.cc:49
void setVideo9000Active(int video9000Source_, Video9000Active active)
Definition: VideoLayer.hh:42
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
VideoLayer(const VideoLayer &)=delete
bool needRecord() const
Definition: VideoLayer.cc:95
Generic Gang-of-Four Observer class, templatized edition.
Definition: Observer.hh:9
VideoLayer & operator=(const VideoLayer &)=delete
~VideoLayer() override
Definition: VideoLayer.cc:31