summaryrefslogtreecommitdiff
path: root/app/sdl/impl/display-sdl.cc
blob: d8e22d1adec1d75ca4f92c14c34e6a39e59c10fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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