mirror of
https://github.com/zoriya/ComSquare.git
synced 2026-05-26 07:50:04 +00:00
Creating a real main
This commit is contained in:
@@ -16,29 +16,16 @@ int main(int argc, char **argv)
|
||||
std::cout << "ComSquare:" << std::endl << "\tUsage: " << argv[0] << " rom_path" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
Memory::MemoryBus bus;
|
||||
Renderer::SFRenderer renderer(600, 800, 60);
|
||||
SNES snes(std::make_shared<Memory::MemoryBus>(bus), argv[1], renderer);
|
||||
bus.mapComponents(snes);
|
||||
int incx = 0;
|
||||
int incy = 0;
|
||||
uint32_t pixel = 0x000000FF;
|
||||
|
||||
while (!renderer.shouldExit) {
|
||||
renderer.putPixel(incy, incx++, pixel);
|
||||
if (incx >= 800) {
|
||||
incx = 0;
|
||||
incy++;
|
||||
try {
|
||||
Renderer::SFRenderer renderer(600, 800, 60);
|
||||
SNES snes(std::make_shared<Memory::MemoryBus>(), argv[1], renderer);
|
||||
while (!renderer.shouldExit) {
|
||||
unsigned cycleCount = snes.cpu->update();
|
||||
snes.ppu->update(cycleCount);
|
||||
snes.apu->update(cycleCount);
|
||||
}
|
||||
if (incy >= 600) {
|
||||
incy = 0;
|
||||
}
|
||||
if (incx == 0) {
|
||||
renderer.drawScreen();
|
||||
pixel += 0xFF00FF00;
|
||||
}
|
||||
renderer.getEvents();
|
||||
} catch (std::exception &e) {
|
||||
std::cerr << "An error occurred: " << e.what() << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user