Code: Select all
while (game->isRunning) {
if (game->timeLastTicked + CC_TICKRATE < cc_util_ctms()) {
cc_tickGame(game);
//printf("[CCCore] Current tick: %d\n", game->tick);
}
}
The issue is that this code relies on the real-time clock functionality from the standard library header sys/time.h, which works fine under Unix (and other POSIX-compliant systems), but either doesn't exist or works very differently under cc65 on a 6502 system.
I tried a version of this using sleep() from cc65's unistd.h, but that just doesn't work how I need it to. Is there a better way to define a fixed tick rate for my game?