redesigned display peripheral

This commit is contained in:
2025-03-14 15:48:15 -04:00
parent af39b2ab07
commit ac5313a6ca
5 changed files with 63 additions and 53 deletions

View File

@@ -1,15 +1,12 @@
#pragma once
#include <array>
#include <bitset>
#include <memory>
namespace chocochip8 {
constexpr size_t gcWidth = 128;
constexpr size_t gcHeight = 64;
using Scanline = std::bitset<gcWidth>;
using Framebuffer = std::array<Scanline, gcHeight>;
enum class Key {
KEY_0, KEY_1, KEY_2, KEY_3,
@@ -20,11 +17,9 @@ namespace chocochip8 {
class Display {
public:
friend class Interpreter;
Display(): mpFramebuffer{std::make_unique<Framebuffer>()} {}
virtual ~Display() = default;
protected:
std::unique_ptr<Framebuffer> mpFramebuffer;
virtual int blit(const Scanline& spriteScanline, int y) = 0;
virtual void clear() = 0;
};
class Buzzer {