-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboard.h
More file actions
85 lines (55 loc) · 1.56 KB
/
board.h
File metadata and controls
85 lines (55 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/**
* \file board.h
* Drawing the game's board.
*/
#ifndef __BOARD_H_
#define __BOARD_H_
#include <SDL/SDL.h>
#include "secret.h"
// Number of possible attempts
#define NB_ATTEMPTS 10
/**
* \return the index of color for pos (x, y) or -1
*/
int place_color(int x, int y, int tryNumber);
void board_draw_color(SDL_Surface *screen, int index, color_t color, int tryNumber);
/**
* Draw a button to validate an attempt.
*/
void board_show_button(SDL_Surface *screen, int tryNumber);
/**
* Clic on the "Verify" button. try must be complete.
* \return 1 only if the try is completed
*/
int clic_verify(int x, int y, int tryNumber) ;
void board_show_result(SDL_Surface *screen, int *result, int tryNumber);
/**
* Show victory or defeat message.
* \param screen the board surface
* \param victory 1 if the secret was found, 0 otherwise
*/
void board_show_ending_message(SDL_Surface *screen, int victory);
/**
* Show the secret after the game has ended.
*/
void board_show_secret(SDL_Surface *screen, code_t *secret);
/**
* Show the places for the colors of next try.
* \param board main window screen
*/
void next_try(SDL_Surface *screen, int tryNumber);
/**
* Test if a clic is on a color on selecting board.
* \return -1 if no color is selected, or the selected color
*/
color_t is_color_selected(int x, int y);
/**
* Mark the newly selected color.
*/
void board_select(SDL_Surface *screen, color_t old, color_t new);
SDL_Surface *create_board();
/**
* Clean the board for beginning a new game.
*/
void board_clean(SDL_Surface *screen);
#endif