kernels,typing-game: assume uptime does not start from zero

* on platform tha can re-run the game, the game will skip some beginning
  frames in the second run
This commit is contained in:
Zihao Yu 2024-01-16 23:33:30 +08:00
parent 9e19ebc991
commit ade50b257a

View file

@ -151,8 +151,9 @@ int main() {
printf("Type 'ESC' to exit\n");
int current = 0, rendered = 0;
uint64_t t0 = io_read(AM_TIMER_UPTIME).us;
while (1) {
int frames = io_read(AM_TIMER_UPTIME).us / (1000000 / FPS);
int frames = (io_read(AM_TIMER_UPTIME).us - t0) / (1000000 / FPS);
for (; current < frames; current++) {
game_logic_update(current);