diff options
| author | Hannes Schulze <haschu0103@outlook.de> | 2025-01-13 22:03:10 +0100 |
|---|---|---|
| committer | Hannes Schulze <haschu0103@outlook.de> | 2025-01-13 22:03:10 +0100 |
| commit | 02f963a4bab95b3a328b6a792c9a7e027ade0e26 (patch) | |
| tree | 70b73691547e756e77eb30f29d7ea16811bae1e3 /src/nes/display.hh | |
| parent | 4366e924e44d4294b9791533486f3ab81317ec71 (diff) | |
implement display
Diffstat (limited to 'src/nes/display.hh')
| -rw-r--r-- | src/nes/display.hh | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/nes/display.hh b/src/nes/display.hh new file mode 100644 index 0000000..14ccff1 --- /dev/null +++ b/src/nes/display.hh @@ -0,0 +1,33 @@ +#pragma once + +namespace nes +{ + class rgb; + + /// Abstraction of the display logic. + class display + { + public: + static constexpr auto width = unsigned{ 256 }; + static constexpr auto height = unsigned{ 240 }; + + virtual ~display() = default; + + display(display const&) = delete; + display(display&&) = delete; + auto operator=(display const&) -> display& = delete; + auto operator=(display&&) -> display& = delete; + + /// Switch between front and back buffers. + virtual auto switch_buffers() -> void = 0; + /// Update the pixel at the given position in the back buffer. + virtual auto set(unsigned x, unsigned y, rgb value) -> void = 0; + /// Load the pixel value at the given position in the back buffer. + virtual auto get(unsigned x, unsigned y) const -> rgb = 0; + /// Clear the entire back buffer with a color. + virtual auto clear(rgb color) -> void; + + protected: + explicit display() = default; + }; +} // namespace nes
\ No newline at end of file |
