-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathscreen.h
88 lines (77 loc) · 2 KB
/
screen.h
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
85
86
87
88
#ifndef __SCREEN_H__
#define __SCREEN_H__
#include "tile.h"
/**
* @brief Draws a tile on the screen.
*
* This function draws a cell on the screen, using the tile to get to the location and value.
*
* @param tile Pointer to the tile that needs drawing.
*/
void
screen_draw_cell(tile *tile);
/**
* @brief Draws the winning message or screen.
*
* This function is called when the goal of 2048 is reached. Use it for drawing a winning
* message.
*/
void
screen_draw_you_won(void);
/**
* @brief Draws a game over message.
*
* This function is called when the game is over, i.e. when no more moves are available.
* It is not called when to goal is reached.
*/
void
screen_draw_game_over(void);
/**
* @brief Draw the message 'restart y/n?' or similar and recobstruct screen afterwards.
*
* This function gets called when the user presses the 'Q' key and is used to ask for a game
* restart. The function should return true when a restart is needed.
* This function needs to reconstruct the screen area it destroyed.
*
* @return bool True when restart needed.
*/
bool
screen_draw_and_ask_restart(void);
/**
* @brief First function called after game start. Use to show title screen.
*
* This function is called first and should be used to show the title screen.
* You can do a keyboard press check here as well to proceed.
* You can use this to do some platform specific setup stuff.
* This function is called once during the lifetime of the game.
*/
void
screen_title(void);
/**
* @brief Use to initialize the playing field.
*
* Use this function to setup the grid.
* This function is called once during the lifetime of the game.
*/
void
screen_init(void);
/**
* @brief Use to reinit the screen after wining or game over.
*/
void
screen_reinit(void);
/**
* @brief Draw all the tiles.
*/
void
screen_draw(void);
/**
* @brief Draw the score.
*
* This function draws the score.
*
* Use the the functions game_score() and game_best_score() to get the values.
*/
void
screen_draw_score(void);
#endif