My Project
play.h File Reference

Contains every functions declaration for play.c. More...

Go to the source code of this file.

Data Structures

struct  TILE
 
struct  LIST
 
struct  LAYOUT
 
struct  TEXT
 

Typedefs

typedef struct TILE TILE
 

Functions

void playGame (LAYOUT *l)
 
void loadLayout (LAYOUT *l)
 
int loadFont (TEXT *t)
 
void resetMap (int m[][NUMBER_CELL])
 
void drawMenu (LAYOUT *l)
 
void drawLayout (LAYOUT *l)
 
void drawText (LAYOUT *l, TEXT *t, char *s, int player)
 
void drawSelected (LAYOUT *l, int pWorker[2])
 
int initPlayer (LAYOUT *l, TEXT *t, int player)
 
int selectWorker (LAYOUT *l, TEXT *t, int player, int pWorker[2])
 
int moveWorker (LAYOUT *l, TEXT *t, int player, int pWorker[2])
 
int buildBlock (LAYOUT *l, TEXT *t, int player, int pWorker[2])
 
int checkWinner (int m[][NUMBER_CELL])
 
void cleanUp (LAYOUT *l)
 
LIST initBoard (LAYOUT *l)
 

Detailed Description

Contains every functions declaration for play.c.

Author
Maxime LEFEBVRE
Date
26/03/2018
Version
1.0

Definition in file play.h.

Typedef Documentation

◆ TILE

typedef struct TILE TILE

Definition at line 12 of file play.h.

Function Documentation

◆ buildBlock()

int buildBlock ( LAYOUT l,
TEXT t,
int  player,
int  pWorker[2] 
)

Build a block or a dome at the selected spot by the specified player.

Parameters
lReference to the layout structure
tReference text structure
pWorkerArray containing the position of the selected worker
playerNumber of the player playing
Returns
Return 1 if all went well, 0 if the player wants to quit the game

Definition at line 427 of file play.c.

◆ checkWinner()

int checkWinner ( int  m[][NUMBER_CELL])

Check if a worker has landed on a third level or not.

Parameters
mArray of integer representing the game board
Returns
Return 1 if there is a winner, 0 otherwise

Definition at line 524 of file play.c.

◆ cleanUp()

void cleanUp ( LAYOUT l)

Free the allocated memory for every game related surfaces.

Parameters
lReference to layout structure

Definition at line 543 of file play.c.

◆ drawLayout()

void drawLayout ( LAYOUT l)

Draw the game on the main window.

Parameters
lReference to the layout structure

Definition at line 141 of file play.c.

◆ drawMenu()

void drawMenu ( LAYOUT l)

Draw the menu on the main window at game launch of after each game.

Parameters
lReference to the layout structure

Definition at line 134 of file play.c.

◆ drawSelected()

void drawSelected ( LAYOUT l,
int  pWorker[2] 
)

Draw the hovering tile on the selected worker. Returns the selected worker position via pointer.

Parameters
lReference to the layout structure
pWorkerArray containing the position of the selected worker

Definition at line 213 of file play.c.

◆ drawText()

void drawText ( LAYOUT l,
TEXT t,
char *  s,
int  player 
)

Draw the specified text on the main window during the game. Each string is displayed as PLAYER d s.

Parameters
lReference to the layout structure
tReference to the text structure

Definition at line 196 of file play.c.

◆ initBoard()

LIST initBoard ( LAYOUT l)

Definition at line 560 of file play.c.

◆ initPlayer()

int initPlayer ( LAYOUT l,
TEXT t,
int  player 
)

Set a new worker at the selected spot for the specified player.

Parameters
lReference to the layout structure
tReference text structure
playerNumber of the player playing
Returns
Return 1 if all went well, 0 if the player wants to quit the game

Definition at line 222 of file play.c.

◆ loadFont()

int loadFont ( TEXT t)

Load the font needed for in-game display.

Parameters
tReference to the text structure
Returns
Return 1 if all went well, 0 otherwise

Definition at line 115 of file play.c.

◆ loadLayout()

void loadLayout ( LAYOUT l)

Load the different images used for the game. Set and launch the main window.

Parameters
lReference to the structure layout

Definition at line 85 of file play.c.

◆ moveWorker()

int moveWorker ( LAYOUT l,
TEXT t,
int  player,
int  pWorker[2] 
)

Move the selected worker to the selected spot by the specified player.

Parameters
lReference to the layout structure
tReference text structure
pWorkerArray containing the position of the selected worker
playerNumber of the player playing
Returns
Return 1 if all went well, 0 if the player wants to quit the game

Definition at line 329 of file play.c.

◆ playGame()

void playGame ( LAYOUT l)

Load the game and handles the players turn.

Parameters
lReference to the layout structure

Definition at line 19 of file play.c.

◆ resetMap()

void resetMap ( int  m[][NUMBER_CELL])

Sets all the board cells to GRASS (value = 0).

Parameters
mArray of integer representing the game board

Definition at line 127 of file play.c.

◆ selectWorker()

int selectWorker ( LAYOUT l,
TEXT t,
int  player,
int  pWorker[2] 
)

Set the selected worker by the specified player.

Parameters
lReference to the layout structure
tReference text structure
pWorkerArray containing the position of the selected worker
playerNumber of the player playing
Returns
Return 1 if all went well, 0 if the player wants to quit the game

Definition at line 274 of file play.c.