forked from snapshot112/minigame-menu
manual??? and refactoring
This commit is contained in:
5
snake.c
5
snake.c
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user