1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #ifndef _GAME_H_
- #define _GAME_H_
- typedef struct {
- int x;
- int y;
- } POINT;
- typedef struct {
- char direction;
- POINT position;
- POINT old_position;
- int value;
- char color;
- int move_tick;
- } BALL;
- typedef struct {
- int head_dir_x;
- int head_dir_y;
-
- int next_head_dir_x;
- int next_head_dir_y;
- POINT* old_tail;
-
- POINT** body;
- int head_ptr;
- int length;
-
- } PLAYER;
- typedef struct {
- int points;
- int status;
- } GAME_STATE;
- typedef struct {
- int width;
- int height;
- BALL** balls;
- int ball_count;
- int max_allocated_balls;
- WINDOW* win;
- PLAYER* player;
- GAME_STATE* state;
- } FIELD;
- extern GAME_STATE* state;
- void set_lost(GAME_STATE* state);
- void set_won(GAME_STATE* state);
- void eat_ball(FIELD* field, int pos);
- void play_game(GAME_STATE* state);
- #endif
|