My Project
play.c
Go to the documentation of this file.
1 
9 #include <stdio.h>
10 #include <math.h>
11 
12 #include <SDL/SDL.h>
13 #include <SDL/SDL_image.h>
14 #include <SDL/SDL_ttf.h>
15 
16 #include "constants.h"
17 #include "play.h"
18 
19 void playGame(LAYOUT *l)
20 {
21  // --- DECLARE VARIABLES ---
22  TEXT text;
23  SDL_Event e;
24  int pSelected[2] = {0};
25  int player = PLAYER2;
26 
27  // --- CONTROL VARIABLES ---
28  int run = 0, test = 1;
29 
30  // --- SET UP THE GAME ---
31  resetMap(l->gameMap); // Reset the map to full GRASS
32  test = loadFont(&text); // Load the font to render texts
33 
34  if(test) test = initPlayer(l, &text, PLAYER1); // If font loaded correctly, Player 1 places a worker
35  if(test) test = initPlayer(l, &text, PLAYER2); // If previous player hasn't escaped the game, Player 2 places a worker
36  if(test) test = initPlayer(l, &text, PLAYER1); // If previous player hasn't escaped the game, Player 1 places a worker
37  if(test) test = initPlayer(l, &text, PLAYER2); // If previous player hasn't escaped the game, Player 2 places a worker
38 
39  // --- EXECUTE APPLICATION CONTINUOUSLY ---
40  while(test && !run) // If neither player has escaped the game, start a new turn
41  {
42  if(player == PLAYER1) player = PLAYER2; // Change player at the
43  else player = PLAYER1; // beginning of each turn
44 
45  test = selectWorker(l, &text, player, pSelected); // Current player selects a worker on the board
46  if(test) test = moveWorker(l, &text, player, pSelected); // If current player didn't escape the game and can move, he moves the selected worker on the board
47  if(test) run = checkWinner(l->gameMap); // If current player didn't escape the game, game checks if current player made a winning move
48  if(test && !run) test = buildBlock(l, &text, player, pSelected); // If current player didn't escape the game and can build, he builds a new blocks
49  }
50 
51  drawLayout(l); // Draw the final board
52 
53  // --- RENDER TEXT ACCORDING TO WINNING/LOSING CONDITIONS ---
54  if(run) drawText(l, &text, "wins !!!\nPress ESC", player); // If run = 1, current player is the winner
55  else drawText(l, &text, "loses...\nPress ESC", player); // If run = 0 and test = 1, current player lost (can't move/build or he escaped the game)
56 
57  run = 1; // Reset control variable
58 
59  // --- WAIT FOR PLAYER ACTION ---
60  while(run)
61  {
62  SDL_WaitEvent(&e); // Wait for the next user event
63  switch(e.type) // Test event type value
64  {
65  case SDL_QUIT: // If the user wants to close the window
66  run = 0; // Stop the application
67  break;
68  case SDL_KEYDOWN: // If the user pressed a keyboard key
69  switch(e.key.keysym.sym) // Test key value
70  {
71  case SDLK_ESCAPE: // If the user pressed the escape key
72  run = 0; // Stop the application
73  break;
74  default: // In any other case, do nothing
75  break;
76  }
77  default: // In any other case, do nothing
78  break;
79  }
80  }
81 
82  TTF_CloseFont(text.font); // Delete text font
83 }
84 
86 {
87  // --- SET UP THE WINDOW
88  l->window = NULL; // Delete window
89 
90  SDL_WM_SetIcon(IMG_Load("art/icon.png"), NULL); // Set window icon
91  l->window = SDL_SetVideoMode(WINDOW_WIDTH, WINDOW_HEIGHT, 32, SDL_HWSURFACE | SDL_DOUBLEBUF); // Set video mode and window size
92  SDL_WM_SetCaption("Santorini by ML (mlefebvre.fr)", NULL); // Set window caption
93 
94  // --- LOAD IMAGES ---
95  l->menu = IMG_Load("art/menu.png");
96  l->header = IMG_Load("art/header.png");
97  l->grass = IMG_Load("art/grass.png");
98  l->first = IMG_Load("art/first.png");
99  l->second = IMG_Load("art/second.png");
100  l->third = IMG_Load("art/third.png");
101  l->dome = IMG_Load("art/dome.png");
102  l->player1 = IMG_Load("art/player1.png");
103  l->player2 = IMG_Load("art/player2.png");
104  l->selected = IMG_Load("art/selected.png");
105  l->possible = IMG_Load("art/possible.png");
106 
107  // --- SET BACKGROUND POSITION ---
108  l->pBackground.x = 0;
109  l->pBackground.y = 0;
110 
111  // --- RESET THE BOARD ---
112  resetMap(l->gameMap);
113 }
114 
115 int loadFont(TEXT *t)
116 {
117  t->fontPath = "data/Gelio Fasolada.ttf"; // Set font path
118  t->fontColor.r = 0; // Set red component of the font
119  t->fontColor.g = 0; // Set green component of the font
120  t->fontColor.b = 0; // Set blue component of the font
121  t->font = TTF_OpenFont(t->fontPath, FONT_SIZE); // Create font reference
122 
123  if(t->font == NULL) return 0; // If font has not been loaded properly, return 0
124  else return 1; // Else return 1
125 }
126 
127 void resetMap(int m[][NUMBER_CELL])
128 {
129  for(int i = 0 ; i < NUMBER_CELL ; i++)
130  for(int j = 0 ; j < NUMBER_CELL ; j++)
131  m[i][j] = GRASS; // Set the whole board to GRASS (see constants)
132 }
133 
134 void drawMenu(LAYOUT *l)
135 {
136  SDL_FillRect(l->window, NULL, SDL_MapRGB(l->window->format, 0, 0, 0)); // Set window to black
137  SDL_BlitSurface(l->menu, NULL, l->window, &(l->pBackground)); // Add menu to window
138  SDL_Flip(l->window); // Draw window
139 }
140 
142 {
143  // --- DECLARE VARIABLES ---
144  int i, j;
145 
146  SDL_FillRect(l->window, NULL, SDL_MapRGB(l->window->format, 0, 0, 0)); // Set window to black
147 
148  for(i = 0 ; i < NUMBER_CELL ; i++) // For each line
149  {
150  l->pCell.x = GRID_START_X + i * CELL_SIZE; // Set current line x position
151 
152  for(j = 0 ; j < NUMBER_CELL ; j++) // For each cell of specified line
153  {
154  l->pCell.y = GRID_START_Y + j * CELL_SIZE; // Set current cell y position
155 
156  // --- TILES HANDLING ---
157  switch(l->gameMap[i][j]) // Test the corresponding array value
158  {
159  case FIRST: case FIRST + P1: case FIRST + P2: // If it is a first floor (empty or not)
160  SDL_BlitSurface(l->first, NULL, l->window, &(l->pCell)); // Add a first floor to the window
161  break;
162  case SECOND: case SECOND + P1: case SECOND + P2: // If it is a second floor (empty or not)
163  SDL_BlitSurface(l->second, NULL, l->window, &(l->pCell)); // Add a second floor to the window
164  break;
165  case THIRD: case THIRD + P1: case THIRD + P2: // If it is a third floor (empty or not)
166  SDL_BlitSurface(l->third, NULL, l->window, &(l->pCell)); // Add a third floor to the window
167  break;
168  case DOME: // If it is a dome
169  SDL_BlitSurface(l->dome, NULL, l->window, &(l->pCell)); // Add a dome to the window
170  break;
171  default:
172  SDL_BlitSurface(l->grass, NULL, l->window, &(l->pCell)); // Otherwise add grass to the window
173  break;
174  }
175 
176  // --- WORKERS HANDLING ---
177  switch(l->gameMap[i][j]) // Test the corresponding array value
178  {
179  case GRASS + P1: case FIRST + P1: case SECOND + P1: case THIRD + P1: // If there is a worker for Player 1
180  SDL_BlitSurface(l->player1, NULL, l->window, &(l->pCell)); // Add a worker for Player 1 to the window
181  break;
182  case GRASS + P2: case FIRST + P2: case SECOND + P2: case THIRD + P2: // If there is a worker for Player 2
183  SDL_BlitSurface(l->player2, NULL, l->window, &(l->pCell)); // Add a worker for Player 2 to the window
184  break;
185  default:
186  break;
187  }
188  }
189  }
190 
191  SDL_BlitSurface(l->header, NULL, l->window, &(l->pBackground)); // Add the foreground decoration to the window
192 
193  SDL_Flip(l->window); // Draw window
194 }
195 
196 void drawText(LAYOUT *l, TEXT *t, char* s, int player)
197 {
198  // --- DECLARE VARIABLES ---
199  char text[50] = {"\0"};
200 
201  // --- RENDER TEXT ---
202  sprintf(text, "Player %d %s", player, s); // Send formatted text to the text string
203  t->text = TTF_RenderText_Blended(t->font, text, t->fontColor); // Render the text with the application font
204 
205  t->pText.x = WINDOW_WIDTH / 2 - t->text->w / 2; // Center text vertically and horizontally
206  t->pText.y = TEXT_START_Y + TEXT_H / 2 - t->text->h / 2; // with the dedicated space on the background
207 
208  SDL_BlitSurface(t->text, NULL, l->window, &(t->pText)); // Add the text to the window
209 
210  SDL_Flip(l->window); // Draw window
211 }
212 
213 void drawSelected(LAYOUT *l, int pWorker[2])
214 {
215  l->pCell.x = GRID_START_X + pWorker[0] * CELL_SIZE; // Set the position of the selected surface
216  l->pCell.y = GRID_START_Y + pWorker[1] * CELL_SIZE; // to the position of the selected worker
217 
218  SDL_BlitSurface(l->selected, NULL, l->window, &(l->pCell)); // Add surface to the window
219  SDL_Flip(l->window); // Draw window
220 }
221 
222 int initPlayer(LAYOUT *l, TEXT *t, int player)
223 {
224  // --- DECLARE VARIABLES ---
225  SDL_Event e;
226  int x = 0, y = 0;
227 
228  // --- CONTROL VARIABLES ---
229  int run = 1, test = 1;
230 
231  // --- DRAW THE INITIAL LAYOUT ---
232  drawLayout(l);
233  drawText(l, t, "places a worker", player);
234 
235  // --- WAIT FOR PLAYER ACTION ---
236  while(run)
237  {
238  SDL_WaitEvent(&e); // Wait for the next user event
239  switch(e.type) // Test event type value
240  {
241  case SDL_QUIT: // If the user wants to close the window
242  run = 0; // Escape the function
243  test = 0; // Stop the application
244  break;
245  case SDL_MOUSEBUTTONUP: // If the player clicks on a cell
246 
247  x = (e.button.x - GRID_START_X) / CELL_SIZE; // Get cell x position
248  y = (e.button.y - GRID_START_Y) / CELL_SIZE; // Get cell y position
249 
250  if(l->gameMap[x][y] == GRASS) // If selected cell is empty
251  {
252  l->gameMap[x][y] = 5 * player; // Place a worker for the specified player
253  run = 0; // Escape the function
254  }
255  break;
256  case SDL_KEYDOWN: // If the user pressed a keyboard key
257  switch(e.key.keysym.sym) // Test key value
258  {
259  case SDLK_ESCAPE: // If the user pressed the escape key
260  run = 0; // Escape the function
261  test = 0; // Stop the application
262  break;
263  default: // In any other case, do nothing
264  break;
265  }
266  default: // In any other case, do nothing
267  break;
268  }
269  }
270 
271  return test; // Return the success of the function
272 }
273 
274 int selectWorker(LAYOUT *l, TEXT *t, int player, int pWorker[2])
275 {
276  // --- DECLARE VARIABLES ---
277  SDL_Event e;
278  int x = 0, y = 0;
279 
280  // --- CONTROL VARIABLES ---
281  int run = 1, test = 1;
282 
283  // --- DRAW THE INITIAL LAYOUT ---
284  drawLayout(l);
285  drawText(l, t, "selects a worker", player);
286 
287  // --- WAIT FOR PLAYER ACTION ---
288  while(run)
289  {
290  SDL_WaitEvent(&e); // Wait for the next user event
291  switch(e.type) // Test event type value
292  {
293  case SDL_QUIT: // If the user wants to close the window
294  run = 0; // Escape the function
295  test = 0; // Stop the application
296  break;
297  case SDL_MOUSEBUTTONUP: // If the player clicks on a cell
298 
299  x = (e.button.x - GRID_START_X) / CELL_SIZE; // Get cell x position
300  y = (e.button.y - GRID_START_Y) / CELL_SIZE; // Get cell y position
301 
302  if(((5 * player) <= l->gameMap[x][y]) && // If the array value for the selected cell
303  (l->gameMap[x][y] < (5 * (player + 1)))) // is in the range of the specified player
304  {
305  pWorker[0] = x; // Set selected worker position
306  pWorker[1] = y; // to identify it during the turn
307 
308  run = 0; // Escape the function
309  }
310  break;
311  case SDL_KEYDOWN: // If the user pressed a keyboard key
312  switch(e.key.keysym.sym) // Test key value
313  {
314  case SDLK_ESCAPE: // If the user pressed the escape key
315  run = 0; // Escape the function
316  test = 0; // Stop the application
317  break;
318  default: // In any other case, do nothing
319  break;
320  }
321  default: // In any other case, do nothing
322  break;
323  }
324  }
325 
326  return test; // Return the success of the function
327 }
328 
329 int moveWorker(LAYOUT *l, TEXT *t, int player, int pWorker[2])
330 {
331  // --- DECLARE VARIABLES ---
332  SDL_Event e;
333  int xp = pWorker[0], yp = pWorker[1];
334  int x = 0, y = 0;
335  int pPossible[8][2];
336  int cnt = 0, i, j;
337 
338  // --- CONTROL VARIABLES ---
339  int run = 1, test = 1;
340 
341  // --- EMPTY THE POSSIBILITY ARRAY
342  for(i = 0 ; i < 8 ; i++)
343  for(j = 0 ; j < 2 ; j++)
344  pPossible[i][j] = -1;
345 
346  // --- DRAW THE INITIAL LAYOUT ---
347  drawLayout(l);
348  drawSelected(l, pWorker);
349  drawText(l, t, "moves", player);
350 
351  // --- DRAW THE POSSIBILITIES ---
352  for(i = xp - 1 ; i <= xp + 1 ; i++) // For the lines around the selected worker
353  {
354  for(j = yp - 1 ; j <= yp + 1 ; j++) // For the columns around the sleected worker
355  {
356  if((0 <= i) && (i < NUMBER_CELL) && (0 <= j) && (j < NUMBER_CELL) && ((xp != i) || (yp != j))) // If the cell is within the board and not the selected worker
357  {
358  if((l->gameMap[i][j] < DOME) && ((l->gameMap[i][j] + 5 * player - l->gameMap[xp][yp]) <= 1)) // If the cell is an empty block and the level difference with the selected worker is 1 or less
359  {
360  l->pCell.x = GRID_START_X + i * CELL_SIZE; // Set cell x position
361  l->pCell.y = GRID_START_Y + j * CELL_SIZE; // Set cell y position
362 
363  pPossible[cnt][0] = i; // Fill the possibilities
364  pPossible[cnt][1] = j; // array with a new line
365 
366  SDL_BlitSurface(l->possible, NULL, l->window, &(l->pCell)); // Add the possibility surface to the window
367 
368  SDL_Flip(l->window); // Draw the window
369 
370  cnt++; // Increment the counter to jump to the array's next line
371  }
372  }
373  }
374  }
375 
376  if((pPossible[0][0] != -1) && (pPossible[0][1] != -1)) // If the array is not empty
377  {
378  // --- WAIT FOR PLAYER ACTION ---
379  while(run)
380  {
381  SDL_WaitEvent(&e); // Wait for the next user event
382  switch(e.type) // Test event type value
383  {
384  case SDL_QUIT: // If the user wants to close the window
385  run = 0; // Escape the function
386  test = 0; // Stop the application
387  break;
388  case SDL_MOUSEBUTTONUP: // If the player clicks on a cell
389 
390  x = (e.button.x - GRID_START_X) / CELL_SIZE; // Get cell x position
391  y = (e.button.y - GRID_START_Y) / CELL_SIZE; // Get cell y position
392 
393  for(i = 0 ; i < 8 ; i++) // For each possibility
394  {
395  if((pPossible[i][0] == x) && (pPossible[i][1] == y)) // If the selected cell if within the possibility
396  {
397  l->gameMap[xp][yp] -= 5 * player; // Move the selected worker
398  l->gameMap[x][y] += 5 * player; // to its new position
399 
400  pWorker[0] = x; // Save the new
401  pWorker[1] = y; // worker position
402 
403  run = 0; // Escape the function
404  }
405  }
406  break;
407  case SDL_KEYDOWN: // If the user pressed a keyboard key
408  switch(e.key.keysym.sym) // Test key value
409  {
410  case SDLK_ESCAPE: // If the user pressed the escape key
411  run = 0; // Escape the function
412  test = 0; // Stop the application
413  break;
414  default: // In any other case, do nothing
415  break;
416  }
417  default: // In any other case, do nothing
418  break;
419  }
420  }
421  }
422  else test = 0; // Else, if the selected worker, cannot move
423 
424  return test; // Return the success of the function
425 }
426 
427 int buildBlock(LAYOUT *l, TEXT *t, int player, int pWorker[2])
428 {
429  // --- DECLARE VARIABLES ---
430  SDL_Event e;
431  int xp = pWorker[0], yp = pWorker[1];
432  int x = 0, y = 0;
433  int pPossible[8][2];
434  int cnt = 0, i, j;
435 
436  // --- CONTROL VARIABLES
437  int run = 1, test = 1;
438 
439  // --- EMPTY THE POSSIBILITY ARRAY
440  for(i = 0 ; i < 8 ; i++)
441  for(j = 0 ; j < 2 ; j++)
442  pPossible[i][j] = -1;
443 
444  // --- DRAW THE INITIAL LAYOUT ---
445  drawLayout(l);
446  drawSelected(l, pWorker);
447  drawText(l, t, "builds a block", player);
448 
449  // --- DRAW THE POSSIBILITIES ---
450  for(i = xp - 1 ; i <= xp + 1 ; i++) // For the lines around the selected worker
451  {
452  for(j = yp - 1 ; j <= yp + 1 ; j++) // For the columns around the sleected worker
453  {
454  if((0 <= i) && (i < NUMBER_CELL) && (0 <= j) && (j < NUMBER_CELL) && ((xp != i) || (yp != j))) // If the cell is within the board and not the selected worker
455  {
456  if(l->gameMap[i][j] < DOME) // If the cell is an empty block
457  {
458  l->pCell.x = GRID_START_X + i * CELL_SIZE; // Set cell x position
459  l->pCell.y = GRID_START_Y + j * CELL_SIZE; // Set cell y position
460 
461  pPossible[cnt][0] = i; // Fill the possibilities
462  pPossible[cnt][1] = j; // array with a new line
463 
464  SDL_BlitSurface(l->possible, NULL, l->window, &(l->pCell)); // Add the possibility surface to the window
465 
466  SDL_Flip(l->window); // Draw window
467 
468  cnt++; // Increment the counter to jump to the array's next line
469  }
470  }
471  }
472  }
473 
474  if((pPossible[0][0] != -1) && (pPossible[0][1] != -1)) // If the array is not empty
475  {
476  // --- WAIT FOR PLAYER ACTION ---
477  while(run)
478  {
479  SDL_WaitEvent(&e); // Wait for the next user event
480  switch(e.type) // Test event type value
481  {
482  case SDL_QUIT: // If the user wants to close the window
483  run = 0; // Escape the function
484  test = 0; // Stop the application
485  break;
486  case SDL_MOUSEBUTTONUP: // If the player clicks on a cell
487 
488  x = (e.button.x - GRID_START_X) / CELL_SIZE; // Get cell x position
489  y = (e.button.y - GRID_START_Y) / CELL_SIZE; // Get cell y position
490 
491  for(i = 0 ; i < 8 ; i++) // For each possibility
492  {
493  if((pPossible[i][0] == x) && (pPossible[i][1] == y)) // If the selected cell if within the possibility
494  {
495  l->gameMap[x][y] += 1; // Increase the building level by 1
496 
497  pWorker[0] = -1; // Reset selected worker position
498  pWorker[1] = -1; // for the next turn (other player)
499 
500  run = 0; // Escape the function
501  }
502  }
503  break;
504  case SDL_KEYDOWN: // If the user pressed a keyboard key
505  switch(e.key.keysym.sym) // Test key value
506  {
507  case SDLK_ESCAPE: // If the user pressed the escape key
508  run = 0; // Escape the function
509  test = 0; // Stop the application
510  break;
511  default: // In any other case, do nothing
512  break;
513  }
514  default: // In any other case, do nothing
515  break;
516  }
517  }
518  }
519  else test = 0; // Else, if the selected worker, cannot move
520 
521  return test; // Return the success of the function
522 }
523 
525 {
526  // --- DECLARE VARIABLES
527  int winner = 0;
528 
529  for(int i = 0 ; i < NUMBER_CELL ; i++) // For each line
530  {
531  for(int j = 0 ; j < NUMBER_CELL ; j++) // For each board cell
532  {
533  if((m[i][j] == (THIRD + P1)) || (m[i][j] == (THIRD + P2))) // If a worker moved to a third level
534  {
535  winner = 1; // Set the test variable to 1
536  }
537  }
538  }
539 
540  return winner; // Return the test variable, to indicate if there is a winner
541 }
542 
543 void cleanUp(LAYOUT *l)
544 {
545  // --- FREE STRUCTURE SURFACE FROM MEMORY ---
546  SDL_FreeSurface(l->possible);
547  SDL_FreeSurface(l->selected);
548  SDL_FreeSurface(l->player2);
549  SDL_FreeSurface(l->player1);
550  SDL_FreeSurface(l->dome);
551  SDL_FreeSurface(l->third);
552  SDL_FreeSurface(l->second);
553  SDL_FreeSurface(l->first);
554  SDL_FreeSurface(l->grass);
555  SDL_FreeSurface(l->header);
556  SDL_FreeSurface(l->menu);
557  SDL_FreeSurface(l->window);
558 }
559 
561 {
562  LIST *list = malloc(sizeof(*LIST));
563  TILE *tile = malloc(sizeof(*TILE));
564 
565  if (list == NULL || TILE == NULL)
566  {
567  exit(EXIT_FAILURE);
568  }
569 
570  tile->top = CASTLE;
571  tile->left = ROAD;
572  tile->bottom = GRASS;
573  tile->right = ROAD;
574  tile->topTile = NULL;
575  tile->leftTile = NULL;
576  tile->bottomTile = NULL;
577  tile->rightTile = NULL;
578  tile->meeple = NONE;
579  list->selected = tile;
580 
581  return liste;
582 }
int moveWorker(LAYOUT *l, TEXT *t, int player, int pWorker[2])
Definition: play.c:329
#define TEXT_START_Y
Definition: constants.h:20
int checkWinner(int m[][NUMBER_CELL])
Definition: play.c:524
SDL_Surface * player2
Definition: play.h:63
TILE * topTile
Definition: play.h:20
SDL_Rect pText
Definition: play.h:86
#define NUMBER_CELL
Definition: constants.h:18
#define TEXT_H
Definition: constants.h:21
TILE * leftTile
Definition: play.h:21
SDL_Surface * first
Definition: play.h:58
SDL_Rect pCell
Definition: play.h:67
int selectWorker(LAYOUT *l, TEXT *t, int player, int pWorker[2])
Definition: play.c:274
Contains every application constants.
void drawText(LAYOUT *l, TEXT *t, char *s, int player)
Definition: play.c:196
void loadLayout(LAYOUT *l)
Definition: play.c:85
void drawSelected(LAYOUT *l, int pWorker[2])
Definition: play.c:213
SDL_Surface * third
Definition: play.h:60
#define P1
Definition: constants.h:22
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
void playGame(LAYOUT *l)
Definition: play.c:19
#define GRID_START_Y
Definition: constants.h:16
int top
Definition: play.h:16
SDL_Surface * text
Definition: play.h:85
SDL_Surface * second
Definition: play.h:59
void drawMenu(LAYOUT *l)
Definition: play.c:134
void drawLayout(LAYOUT *l)
Definition: play.c:141
TILE * selected
Definition: play.h:29
const char * fontPath
Definition: play.h:83
Contains every functions declaration for play.c.
SDL_Surface * header
Definition: play.h:56
SDL_Surface * menu
Definition: play.h:55
Definition: play.h:27
SDL_Surface * window
Definition: play.h:54
SDL_Color fontColor
Definition: play.h:84
Definition: play.h:80
LIST initBoard(LAYOUT *l)
Definition: play.c:560
#define FONT_SIZE
Definition: constants.h:19
#define GRID_START_X
Definition: constants.h:15
SDL_Surface * selected
Definition: play.h:64
#define WINDOW_HEIGHT
Definition: constants.h:14
void cleanUp(LAYOUT *l)
Definition: play.c:543
SDL_Rect pBackground
Definition: play.h:66
int bottom
Definition: play.h:18
int buildBlock(LAYOUT *l, TEXT *t, int player, int pWorker[2])
Definition: play.c:427
TILE * bottomTile
Definition: play.h:22
Definition: constants.h:28
int left
Definition: play.h:17
void resetMap(int m[][NUMBER_CELL])
Definition: play.c:127
SDL_Surface * possible
Definition: play.h:65
Definition: play.h:52
int right
Definition: play.h:19
int gameMap[5][5]
Definition: play.h:68
int initPlayer(LAYOUT *l, TEXT *t, int player)
Definition: play.c:222
#define CELL_SIZE
Definition: constants.h:17
int loadFont(TEXT *t)
Definition: play.c:115
#define WINDOW_WIDTH
Definition: constants.h:13
SDL_Surface * grass
Definition: play.h:57
Definition: constants.h:33
#define P2
Definition: constants.h:23
Definition: constants.h:36