FreeRTOS Tetris
gui.h
Go to the documentation of this file.
1 
23 #ifndef GUI_H
24 #define GUI_H
25 
26 #include "tetrisConfig.h"
27 #include "logic.h"
33 #define MODE_EASY_WIDTH 60
34 #define MODE_FAIR_WIDTH 61
35 #define MODE_HARD_WIDTH 60
36 #define MODE_RANDOM_WIDTH 90
37 #define MODE_DETERMINISTIC_WIDTH 198
38 #define MODES_HEIGHT 500
39 
41 // **********************************************************************************
42 // Menus & Screens ******************************************************************
43 // **********************************************************************************
53 void vGUIDrawMainMenu( game_mode_t mode,
54  player_mode_t playerMode,
55  rotation_t rotationMode,
56  bool isConnected);
57 
58 
66 bool bGUIDrawLevelScreen(uint8_t *currentLevel, const score_t highScores[]);
67 
73 void vGUIDrawStatic(const image_handle_t squares[], const score_t *score);
74 
81 void vGUIDrawPauseMenu(bool isConnected);
82 
91 void vGUIDrawGameOverMenu(score_t *score, char *lastUserName);
92 
93 // **********************************************************************************
94 // Selections ***********************************************************************
95 // **********************************************************************************
102 
108 bool bGUIDrawRotationSelection(rotation_t *rotationMode);
109 
114 bool bGUIDrawLevelMenuSelection(void);
115 
116 // **********************************************************************************
117 // Tetrominos ***********************************************************************
118 // **********************************************************************************
127 void vGUIDrawTetromino(const tetromino_t *tetromino, const image_handle_t squares[]);
128 
134 void vGUIDrawLanded(const color_t landed[ROWS][COLS], const image_handle_t squares[]);
135 
141 void vGUIDrawNextTetromino(const tetromino_t *tetromino, const image_handle_t squares[]);
142 
143 // **********************************************************************************
144 // Helper functions *****************************************************************
145 // **********************************************************************************
149 void vGUIDrawFPS(void);
150 
155 void vGUISetImageHandle(image_handle_t squares[]);
156 
159 #endif //GUI_H
vGUIDrawLanded
void vGUIDrawLanded(const color_t landed[ROWS][COLS], const image_handle_t squares[])
Draw the array of landed tetrominos.
Definition: gui.c:575
vGUIDrawNextTetromino
void vGUIDrawNextTetromino(const tetromino_t *tetromino, const image_handle_t squares[])
Draw the upcoming Tetromino in the upper right corner.
Definition: gui.c:588
bGUIDrawPlayerModeSelection
bool bGUIDrawPlayerModeSelection(player_mode_t *playerMode)
Draw the player-mode selection in Main Menu.
Definition: gui.c:411
vGUIDrawFPS
void vGUIDrawFPS(void)
Draw an FPS counter.
Definition: gui.c:620
vGUIDrawStatic
void vGUIDrawStatic(const image_handle_t squares[], const score_t *score)
Draw the wall, score, level & number of lines completed.
Definition: gui.c:286
vGUIDrawMainMenu
void vGUIDrawMainMenu(game_mode_t mode, player_mode_t playerMode, rotation_t rotationMode, bool isConnected)
Draw the main menu.
Definition: gui.c:68
ROWS
#define ROWS
Number of rows, that the board contains.
Definition: tetrisConfig.h:80
color_t
enum color color_t
Tetromino colors.
tetrisConfig.h
File containing some game configurations.
COLS
#define COLS
Number of columns, that the board contains.
Definition: tetrisConfig.h:79
rotation_t
enum rotation rotation_t
Rotations.
vGUIDrawTetromino
void vGUIDrawTetromino(const tetromino_t *tetromino, const image_handle_t squares[])
Draw the current Tetromino.
Definition: gui.c:562
bGUIDrawLevelMenuSelection
bool bGUIDrawLevelMenuSelection(void)
Draws & let the player switch to the level selection/highscores screen.
Definition: gui.c:488
tetromino
Structure representing a Tetromino.
Definition: logic.h:52
bGUIDrawLevelScreen
bool bGUIDrawLevelScreen(uint8_t *currentLevel, const score_t highScores[])
Draw the level selection & highscores screen.
Definition: gui.c:164
score
Structure for the score.
Definition: logic.h:70
logic.h
Header file for logic.c.
vGUIDrawPauseMenu
void vGUIDrawPauseMenu(bool isConnected)
Draw the Pause Menu.
Definition: gui.c:326
vGUISetImageHandle
void vGUISetImageHandle(image_handle_t squares[])
Takes an image_handle_t array & initializes it with the correct images.
Definition: gui.c:661
image_handle_t
void * image_handle_t
Handle used to reference loaded images, an invalid image will have a NULL handle.
Definition: TUM_Draw.h:130
bGUIDrawRotationSelection
bool bGUIDrawRotationSelection(rotation_t *rotationMode)
Draw rotation-mode selection in Main Menu.
Definition: gui.c:446
game_mode_t
enum game_mode game_mode_t
Game modes supported by the "opponent".
player_mode_t
enum player_mode player_mode_t
Player modes.
vGUIDrawGameOverMenu
void vGUIDrawGameOverMenu(score_t *score, char *lastUserName)
Draw the Game-Over Menu.
Definition: gui.c:370