manual??? and refactoring

This commit is contained in:
2025-10-17 21:08:03 +02:00
parent a2d4290076
commit 103f85d07e
15 changed files with 211 additions and 52 deletions

View File

@@ -244,7 +244,7 @@ static void update_snake(coordinate new_head, snake_action action) {
static void *snake_move(void *arg) {
struct timespec timer;
timer.tv_sec = 0;
timer.tv_nsec = 250000000L;
timer.tv_nsec = 250000000L; // Snake moves every 0.25 seconds.
while (rooster_vraag_toestand(GRID) == STATE_AAN_HET_SPELEN) {
nanosleep(&timer, NULL);
@@ -311,6 +311,7 @@ static void *play_snake(void *arg) {
turn_snake(DIRECTION_RIGHT);
break;
case KEY_BACKSPACE:
case KEY_ESCAPE:
rooster_zet_toestand(GRID, STATE_QUIT);
break;
}
@@ -352,5 +353,5 @@ void snake(void) {
pthread_mutex_destroy(&MUTEX);
rooster_klaar(GRID);
graceful_exit();
graceful_exit(MESSAGE_LOCATION);
}