summaryrefslogtreecommitdiff
path: root/app/mac/impl/display-spritekit.hh
blob: 64e3b03325251e09e4be6fd0b2146aa4fce4d02d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once

#import "nes/common/display.hh"

#import <SpriteKit/SpriteKit.h>

namespace nes::app::mac
{
	/// Display implementation rendering contents into a SpriteKit node.
	class display_spritekit final : public display
	{
		SKSpriteNode* node_;
		NSMutableData* buffer_front_;
		NSMutableData* buffer_back_;
		u8* bytes_back_;

	public:
		explicit display_spritekit(SKSpriteNode* node);

		virtual auto switch_buffers() -> void override;
		virtual auto set(u32 x, u32 y, rgb value) -> void override;
		virtual auto get(u32 x, u32 y) const -> rgb override;
	};
} // namespace nes::app::mac