diff options
| author | Hannes Schulze <haschu0103@outlook.de> | 2025-02-06 16:28:39 +0100 |
|---|---|---|
| committer | Hannes Schulze <haschu0103@outlook.de> | 2025-02-06 16:28:39 +0100 |
| commit | 30b4364c772114303d9045677186a53855ea5343 (patch) | |
| tree | 3ac3443cdea7274e688bc633fa12bf1e089d6624 /app/mac | |
| parent | 64308c9e520dbd8e72b675d0ba064ecdaf9bd494 (diff) | |
implement in-game popups
Diffstat (limited to 'app/mac')
| -rw-r--r-- | app/mac/impl/display-spritekit.hh | 1 | ||||
| -rw-r--r-- | app/mac/impl/display-spritekit.mm | 9 |
2 files changed, 6 insertions, 4 deletions
diff --git a/app/mac/impl/display-spritekit.hh b/app/mac/impl/display-spritekit.hh index 64e3b03..334d492 100644 --- a/app/mac/impl/display-spritekit.hh +++ b/app/mac/impl/display-spritekit.hh @@ -13,6 +13,7 @@ namespace nes::app::mac NSMutableData* buffer_front_; NSMutableData* buffer_back_; u8* bytes_back_; + u8* bytes_front_; public: explicit display_spritekit(SKSpriteNode* node); diff --git a/app/mac/impl/display-spritekit.mm b/app/mac/impl/display-spritekit.mm index b6123d6..a5809c3 100644 --- a/app/mac/impl/display-spritekit.mm +++ b/app/mac/impl/display-spritekit.mm @@ -16,13 +16,14 @@ namespace nes::app::mac , buffer_front_{ make_buffer() } , buffer_back_{ make_buffer() } , bytes_back_{ static_cast<u8*>([buffer_back_ mutableBytes]) } + , bytes_front_{ static_cast<u8*>([buffer_front_ mutableBytes]) } { } auto display_spritekit::switch_buffers() -> void { std::swap(buffer_back_, buffer_front_); - bytes_back_ = static_cast<u8*>([buffer_back_ mutableBytes]); + std::swap(bytes_back_, bytes_front_); auto texture = [SKTexture textureWithData:buffer_front_ size:CGSizeMake(width, height) flipped:YES]; [texture setFilteringMode:SKTextureFilteringNearest]; @@ -42,9 +43,9 @@ namespace nes::app::mac { auto const offset = (y * width + x) * 4; auto res = rgb{}; - res.r = bytes_back_[offset + 0]; - res.g = bytes_back_[offset + 1]; - res.b = bytes_back_[offset + 2]; + res.r = bytes_front_[offset + 0]; + res.g = bytes_front_[offset + 1]; + res.b = bytes_front_[offset + 2]; return res; } } // namespace nes::app::mac
\ No newline at end of file |
