implemented keypad
This commit is contained in:
13
main.cpp
13
main.cpp
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user