implemented keypad

This commit is contained in:
2025-03-15 01:58:27 -04:00
parent 19506dd218
commit bba46296b1
6 changed files with 83 additions and 13 deletions

View File

@@ -8,9 +8,8 @@
#include "BuzzerSDL.hpp"
#include "CountdownTimerSDL.hpp"
#include "DisplaySDL.hpp"
#include "KeypadSDL.hpp"
#include "Interpreter.hpp"
#include "Peripherals.hpp"
#include "SDL2/SDL_events.h"
int main(int argc, char* argv[]) {
if (SDL_Init(SDL_INIT_EVERYTHING) < 0) {
@@ -18,17 +17,13 @@ int main(int argc, char* argv[]) {
return 1;
}
class TestKeypad : public chocochip8::Keypad {
bool isKeyPressed(chocochip8::Key) override { return false; }
};
BuzzerSDL buzzer(440);
int N = 4;
DisplaySDL display(128*N, 64*N);
TestKeypad keypad;
KeypadSDL keypad;
CountdownTimerSDL delayTimer(60);
CountdownTimerSDL soundTimer(60);
CountdownTimerSDL displayTimer(20);
CountdownTimerSDL displayTimer(60);
chocochip8::Interpreter chip8(display, buzzer, keypad, delayTimer, soundTimer);
auto rom = std::vector<char>();
@@ -46,6 +41,8 @@ int main(int argc, char* argv[]) {
while(SDL_PollEvent(&event)) {
if(event.type == SDL_QUIT) {
done = true;
} else {
keypad.processEvent(event);
}
}
chip8.tick();