From 0de4957a22dd408793d0526351bcb7d61786fe86 Mon Sep 17 00:00:00 2001 From: Hannes Schulze Date: Fri, 7 Feb 2025 22:15:57 +0100 Subject: add sdl implementation --- app/sdl/impl/display-sdl.hh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 app/sdl/impl/display-sdl.hh (limited to 'app/sdl/impl/display-sdl.hh') diff --git a/app/sdl/impl/display-sdl.hh b/app/sdl/impl/display-sdl.hh new file mode 100644 index 0000000..9310eca --- /dev/null +++ b/app/sdl/impl/display-sdl.hh @@ -0,0 +1,24 @@ +#pragma once + +#include "nes/common/display.hh" + +#include + +namespace nes::app::sdl +{ + /// Display implementation rendering contents into an SDL texture. + class display_sdl final : public display + { + SDL_Texture* texture_{ nullptr }; + u32 buffer_back_[width * height]{}; + + public: + explicit display_sdl() = default; + + auto get_texture() const -> SDL_Texture* { return texture_; } + auto set_texture(SDL_Texture* v) -> void { texture_ = v; } + + auto switch_buffers() -> void override; + auto set(u32 x, u32 y, rgb value) -> void override; + }; +} // namespace nes::app::sdl -- cgit v1.3.1