openMSX
VideoLayer.hh
Go to the documentation of this file.
1#ifndef VIDEOLAYER_HH
2#define VIDEOLAYER_HH
3
5#include "Layer.hh"
6#include "Observer.hh"
7#include "MSXEventListener.hh"
8#include <string>
9
10namespace openmsx {
11
12class MSXMotherBoard;
13class Display;
14class Setting;
15class BooleanSetting;
16
17class VideoLayer : public Layer, protected Observer<Setting>
18 , private MSXEventListener
19{
20public:
21 VideoLayer(const VideoLayer&) = delete;
23 VideoLayer& operator=(const VideoLayer&) = delete;
25
30 [[nodiscard]] int getVideoSource() const;
31 [[nodiscard]] int getVideoSourceSetting() const;
32
36 virtual void takeRawScreenShot(
37 unsigned height, const std::string& filename) = 0;
38
39 // We used to test whether a Layer is active by looking at the
40 // Z-coordinate (Z_MSX_ACTIVE vs Z_MSX_PASSIVE). Though in case of
41 // Video9000 it's possible the Video9000 layer is selected, but we
42 // still need to render this layer (the v99x8 or v9990 layer).
43 enum class Video9000Active { NO, FRONT, BACK };
44 void setVideo9000Active(int video9000Source_, Video9000Active active) {
45 video9000Source = video9000Source_;
46 activeVideo9000 = active;
47 }
48 [[nodiscard]] bool needRender() const;
49 [[nodiscard]] bool needRecord() const;
50
51protected:
52 VideoLayer(MSXMotherBoard& motherBoard,
53 const std::string& videoSource);
54 ~VideoLayer() override;
55
56 // Observer<Setting> interface:
57 void update(const Setting& setting) noexcept override;
58
59private:
61 void calcZ();
63 void calcCoverage();
64
65 // MSXEventListener
66 void signalMSXEvent(const Event& event,
67 EmuTime::param time) noexcept override;
68
69private:
71 MSXMotherBoard& motherBoard;
73 Display& display;
75 VideoSourceSetting& videoSourceSetting;
77 VideoSourceActivator videoSourceActivator;
79 BooleanSetting& powerSetting;
80
82 int video9000Source = 0;
84 Video9000Active activeVideo9000 = Video9000Active::NO;
85};
86
87} // namespace openmsx
88
89#endif
BaseSetting * setting
Represents the output window/screen of openMSX.
Definition Display.hh:31
Interface for display layers.
Definition Layer.hh:14
Generic Gang-of-Four Observer class, templatized edition.
Definition Observer.hh:10
int getVideoSource() const
Returns the ID for this VideoLayer.
Definition VideoLayer.cc:40
bool needRecord() const
Definition VideoLayer.cc:92
VideoLayer & operator=(VideoLayer &&)=delete
virtual void takeRawScreenShot(unsigned height, const std::string &filename)=0
Create a raw (=non-post-processed) screenshot.
void setVideo9000Active(int video9000Source_, Video9000Active active)
Definition VideoLayer.hh:44
bool needRender() const
Definition VideoLayer.cc:82
VideoLayer & operator=(const VideoLayer &)=delete
int getVideoSourceSetting() const
Definition VideoLayer.cc:44
void update(const Setting &setting) noexcept override
Definition VideoLayer.cc:49
VideoLayer(VideoLayer &&)=delete
~VideoLayer() override
Definition VideoLayer.cc:31
VideoLayer(const VideoLayer &)=delete
This file implemented 3 utility functions:
Definition Autofire.cc:11
std::variant< KeyUpEvent, KeyDownEvent, MouseMotionEvent, MouseButtonUpEvent, MouseButtonDownEvent, MouseWheelEvent, JoystickAxisMotionEvent, JoystickHatEvent, JoystickButtonUpEvent, JoystickButtonDownEvent, OsdControlReleaseEvent, OsdControlPressEvent, WindowEvent, TextEvent, FileDropEvent, QuitEvent, FinishFrameEvent, CliCommandEvent, GroupEvent, BootEvent, FrameDrawnEvent, BreakEvent, SwitchRendererEvent, TakeReverseSnapshotEvent, AfterTimedEvent, MachineLoadedEvent, MachineActivatedEvent, MachineDeactivatedEvent, MidiInReaderEvent, MidiInWindowsEvent, MidiInCoreMidiEvent, MidiInCoreMidiVirtualEvent, MidiInALSAEvent, Rs232TesterEvent, Rs232NetEvent, ImGuiDelayedActionEvent, ImGuiActiveEvent > Event
Definition Event.hh:445