Updated: moved prototypes to header file
This commit is contained in:
parent
fffcbbf123
commit
78971391dd
2 changed files with 23 additions and 22 deletions
22
serpent.c
22
serpent.c
|
@ -48,28 +48,6 @@ Snake *snake;
|
||||||
Apple *apple;
|
Apple *apple;
|
||||||
/* */
|
/* */
|
||||||
|
|
||||||
/* Function prototypes */
|
|
||||||
Snake *startSnake();
|
|
||||||
Apple *startApple();
|
|
||||||
void appendSnakeNode(Snake *new_snake);
|
|
||||||
void freeSnake();
|
|
||||||
int snakeSize();
|
|
||||||
void updateSnake();
|
|
||||||
void updateApple();
|
|
||||||
bool snakeCollision(int x, int y, bool excludeHead);
|
|
||||||
bool appleCollision(int x, int y);
|
|
||||||
void handleInput(int key);
|
|
||||||
void drawGame();
|
|
||||||
int initializeGame();
|
|
||||||
void gameLoop();
|
|
||||||
void run();
|
|
||||||
void mainMenu(WINDOW *menuScreen, int menuType);
|
|
||||||
void cleanup();
|
|
||||||
void argControls();
|
|
||||||
void argHelp();
|
|
||||||
void argVersion();
|
|
||||||
/* */
|
|
||||||
|
|
||||||
int main (int argc, char **argv) {
|
int main (int argc, char **argv) {
|
||||||
/* Command line parsing */
|
/* Command line parsing */
|
||||||
int option;
|
int option;
|
||||||
|
|
23
serpent.h
23
serpent.h
|
@ -1,5 +1,6 @@
|
||||||
#ifndef SERPENT_H
|
#ifndef SERPENT_H
|
||||||
#define SERPENT_H
|
#define SERPENT_H
|
||||||
|
#include <ncurses.h>
|
||||||
|
|
||||||
/* Program information */
|
/* Program information */
|
||||||
#define NAME "serpent"
|
#define NAME "serpent"
|
||||||
|
@ -47,4 +48,26 @@ typedef struct Food {
|
||||||
int pX, pY; /* represents the apple's position on the board */
|
int pX, pY; /* represents the apple's position on the board */
|
||||||
} Apple;
|
} Apple;
|
||||||
|
|
||||||
|
/* Function prototypes */
|
||||||
|
Snake *startSnake();
|
||||||
|
Apple *startApple();
|
||||||
|
void appendSnakeNode(Snake *new_snake);
|
||||||
|
void freeSnake();
|
||||||
|
int snakeSize();
|
||||||
|
void updateSnake();
|
||||||
|
void updateApple();
|
||||||
|
bool snakeCollision(int x, int y, bool excludeHead);
|
||||||
|
bool appleCollision(int x, int y);
|
||||||
|
void handleInput(int key);
|
||||||
|
void drawGame();
|
||||||
|
int initializeGame();
|
||||||
|
void gameLoop();
|
||||||
|
void run();
|
||||||
|
void mainMenu(WINDOW *menuScreen, int menuType);
|
||||||
|
void cleanup();
|
||||||
|
void argControls();
|
||||||
|
void argHelp();
|
||||||
|
void argVersion();
|
||||||
|
/* */
|
||||||
|
|
||||||
#endif //SERPENT_H
|
#endif //SERPENT_H
|
||||||
|
|
Loading…
Reference in a new issue