summaryrefslogtreecommitdiff
path: root/app/sdl/impl/display-sdl.cc
diff options
context:
space:
mode:
authorHannes Schulze <haschu0103@outlook.de>2025-02-07 22:15:57 +0100
committerHannes Schulze <haschu0103@outlook.de>2025-02-07 22:15:57 +0100
commit0de4957a22dd408793d0526351bcb7d61786fe86 (patch)
tree3160c72a45022b1e0b7e5ab928c690e85e20cded /app/sdl/impl/display-sdl.cc
parenta6bfb14562982c8c0139566e5a9b3051543791c4 (diff)
add sdl implementation
Diffstat (limited to 'app/sdl/impl/display-sdl.cc')
-rw-r--r--app/sdl/impl/display-sdl.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/sdl/impl/display-sdl.cc b/app/sdl/impl/display-sdl.cc
new file mode 100644
index 0000000..d8e22d1
--- /dev/null
+++ b/app/sdl/impl/display-sdl.cc
@@ -0,0 +1,16 @@
+#include "impl/display-sdl.hh"
+
+namespace nes::app::sdl
+{
+ auto display_sdl::set(u32 const x, u32 const y, rgb const color) -> void
+ {
+ buffer_back_[(y * width) + x] = (color.r << 24) | (color.g << 16) | (color.b << 8);
+ }
+
+ auto display_sdl::switch_buffers() -> void
+ {
+ if (!texture_) { return; }
+
+ SDL_UpdateTexture(texture_, nullptr, buffer_back_, width * 4);
+ }
+} // namespace nes::app::sdl