My Project
play.h
Go to the documentation of this file.
1 
9 #ifndef H_PLAY
10 #define H_PLAY
11 
12  typedef struct TILE TILE;
13  struct TILE
14  {
15  SDL_Surface *type;
16  int top;
17  int left;
18  int bottom;
19  int right;
24  int meeple;
25  };
26 
27  typedef struct
28  {
30  SDL_Rect pSelected;
31  }LIST;
32 
52  typedef struct
53  {
54  SDL_Surface *window;
55  SDL_Surface *menu;
56  SDL_Surface *header;
57  SDL_Surface *grass;
58  SDL_Surface *first;
59  SDL_Surface *second;
60  SDL_Surface *third;
61  SDL_Surface *dome;
62  SDL_Surface *player1;
63  SDL_Surface *player2;
64  SDL_Surface *selected;
65  SDL_Surface *possible;
66  SDL_Rect pBackground;
67  SDL_Rect pCell;
68  int gameMap[5][5];
69  }LAYOUT;
70 
80  typedef struct
81  {
82  TTF_Font *font;
83  const char* fontPath;
84  SDL_Color fontColor;
85  SDL_Surface *text;
86  SDL_Rect pText;
87  }TEXT;
88 
89 
94  void playGame(LAYOUT *l);
95 
101  void loadLayout(LAYOUT *l);
102 
108  int loadFont(TEXT *t);
109 
114  void resetMap(int m[][NUMBER_CELL]);
115 
120  void drawMenu(LAYOUT *l);
121 
126  void drawLayout(LAYOUT *l);
127 
133  void drawText(LAYOUT *l, TEXT *t, char* s, int player);
134 
140  void drawSelected(LAYOUT *l, int pWorker[2]);
141 
149  int initPlayer(LAYOUT *l, TEXT *t, int player);
150 
159  int selectWorker(LAYOUT *l, TEXT *t, int player, int pWorker[2]);
160 
169  int moveWorker(LAYOUT *l, TEXT *t, int player, int pWorker[2]);
170 
179  int buildBlock(LAYOUT *l, TEXT *t, int player, int pWorker[2]);
180 
186  int checkWinner(int m[][NUMBER_CELL]);
187 
192  void cleanUp(LAYOUT *l);
193 
194  LIST initBoard(LAYOUT *l);
195 
196 #endif // H_PLAY
void cleanUp(LAYOUT *l)
Definition: play.c:543
SDL_Surface * player2
Definition: play.h:63
int buildBlock(LAYOUT *l, TEXT *t, int player, int pWorker[2])
Definition: play.c:427
TILE * topTile
Definition: play.h:20
SDL_Rect pText
Definition: play.h:86
#define NUMBER_CELL
Definition: constants.h:18
TILE * leftTile
Definition: play.h:21
SDL_Surface * first
Definition: play.h:58
SDL_Rect pCell
Definition: play.h:67
void playGame(LAYOUT *l)
Definition: play.c:19
SDL_Rect pSelected
Definition: play.h:30
SDL_Surface * third
Definition: play.h:60
SDL_Surface * player1
Definition: play.h:62
int meeple
Definition: play.h:24
TTF_Font * font
Definition: play.h:82
SDL_Surface * dome
Definition: play.h:61
Definition: play.h:13
TILE * rightTile
Definition: play.h:23
int top
Definition: play.h:16
SDL_Surface * text
Definition: play.h:85
SDL_Surface * second
Definition: play.h:59
TILE * selected
Definition: play.h:29
const char * fontPath
Definition: play.h:83
SDL_Surface * header
Definition: play.h:56
SDL_Surface * menu
Definition: play.h:55
int checkWinner(int m[][NUMBER_CELL])
Definition: play.c:524
int moveWorker(LAYOUT *l, TEXT *t, int player, int pWorker[2])
Definition: play.c:329
Definition: play.h:27
void resetMap(int m[][NUMBER_CELL])
Definition: play.c:127
SDL_Surface * window
Definition: play.h:54
SDL_Color fontColor
Definition: play.h:84
Definition: play.h:80
void drawSelected(LAYOUT *l, int pWorker[2])
Definition: play.c:213
SDL_Surface * selected
Definition: play.h:64
void drawMenu(LAYOUT *l)
Definition: play.c:134
SDL_Rect pBackground
Definition: play.h:66
int bottom
Definition: play.h:18
TILE * bottomTile
Definition: play.h:22
int left
Definition: play.h:17
int loadFont(TEXT *t)
Definition: play.c:115
LIST initBoard(LAYOUT *l)
Definition: play.c:560
SDL_Surface * possible
Definition: play.h:65
Definition: play.h:52
int right
Definition: play.h:19
void drawText(LAYOUT *l, TEXT *t, char *s, int player)
Definition: play.c:196
SDL_Surface * type
Definition: play.h:15
void loadLayout(LAYOUT *l)
Definition: play.c:85
SDL_Surface * grass
Definition: play.h:57
int selectWorker(LAYOUT *l, TEXT *t, int player, int pWorker[2])
Definition: play.c:274
void drawLayout(LAYOUT *l)
Definition: play.c:141
int initPlayer(LAYOUT *l, TEXT *t, int player)
Definition: play.c:222