diff options
| author | Kai Stevenson <kai@kaistevenson.com> | 2023-02-06 00:50:24 -0800 |
|---|---|---|
| committer | Kai Stevenson <kai@kaistevenson.com> | 2023-02-06 00:50:24 -0800 |
| commit | 3e86fe9d5916e7574e630a35639bc2bae68d6f27 (patch) | |
| tree | 7250608f44ce62e3385081891530a05d49681a89 | |
| parent | 0e1eed88f1adf24923d03c120186f131dbc020fd (diff) | |
fixed some formatting
| -rw-r--r-- | snake.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -9,23 +9,22 @@ volatile sig_atomic_t INT_CTRL_C = 0; -// unsafe functions like printf cannot be called in async interrupt handler +//unsafe functions like printf cannot be called in async interrupt handler void interrupt_handler(int sig) { INT_CTRL_C = 1; } -const int boardSize = 12; +int boardSize = 12; const int updateInterval = 300000000L; vectorp_t snakePositions; vector_t foodPos; vector_t lastMoveDir; int main(int argc, char **argv) { - printf("\e[?25l"); /* hide cursor */ - + //hide cursor + printf("\e[?25l"); //make a new thread handling interrupts signal(SIGINT, interrupt_handler); - //init values snakePositions = init_vectorp(malloc(5 * sizeof(vector_t)), 5); snakePositions.vectors[0] = init_vector(5, 5); @@ -50,7 +49,7 @@ int main(int argc, char **argv) { pthread_create(&listenerID, NULL, get_dir_loop, &threadArg); //main game logic loop while(1) { - // handle ctrl-c interrupt + //handle ctrl-c interrupt if (INT_CTRL_C) { //unhide cursor printf("\e[?25h"); |
