Files
choco-chip8/main.cpp

37 lines
742 B
C++

#include <iostream>
#include <SDL2/SDL.h>
#include "BuzzerSDL.hpp"
#include "DisplaySDL.hpp"
#include "Peripherals.hpp"
int main(int argc, char* args[]) {
if (SDL_Init(SDL_INIT_EVERYTHING) < 0) {
std::cerr << "Couldn't initialize SDL: " << SDL_GetError() << '\n';
return 1;
}
class DisplayTest : public DisplaySDL {
public:
DisplayTest() : DisplaySDL(1280, 640, 0xff0000, 0x00ff00) {
for(int i = 0; i < chocochip8::gcHeight; i+=2) {
mpFramebuffer->at(i).set();
}
}
};
BuzzerSDL buzzer(440);
//buzzer.on();
DisplayTest display;
SDL_Event event;
while(SDL_WaitEvent(&event) && event.type != SDL_QUIT) {
display.updateWindow();
}
buzzer.off();
SDL_Quit();
return 0;
}