|
|
|
@ -93,16 +93,8 @@ int main(int argc, char* argv[]) { |
|
|
|
|
|
|
|
|
|
|
|
Display display{window, {0, 0}, {1000, 1000}}; |
|
|
|
Display display{window, {0, 0}, {1000, 1000}}; |
|
|
|
|
|
|
|
|
|
|
|
while (display.active()) { |
|
|
|
while (true) { |
|
|
|
auto currentTime = std::chrono::high_resolution_clock::now(); |
|
|
|
chip8.Cycle(); |
|
|
|
float dt = std::chrono::duration<float, std::chrono::milliseconds::period>(currentTime - lastCycleTime).count(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (dt > cycleDelay) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
lastCycleTime = currentTime; |
|
|
|
|
|
|
|
chip8.Cycle(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
display.update(chip8); |
|
|
|
display.update(chip8); |
|
|
|
display.render(); |
|
|
|
display.render(); |
|
|
|
} |
|
|
|
} |
|
|
|
|