FreeRTOS Tetris
|
Module handling the Graphical User Interface. More...
Functions | |
void | vGUIDrawMainMenu (game_mode_t mode, player_mode_t playerMode, rotation_t rotationMode, bool isConnected) |
Draw the main menu. More... | |
bool | bGUIDrawLevelScreen (uint8_t *currentLevel, const score_t highScores[]) |
Draw the level selection & highscores screen. More... | |
void | vGUIDrawStatic (const image_handle_t squares[], const score_t *score) |
Draw the wall, score, level & number of lines completed. More... | |
void | vGUIDrawPauseMenu (bool isConnected) |
Draw the Pause Menu. More... | |
void | vGUIDrawGameOverMenu (score_t *score, char *lastUserName) |
Draw the Game-Over Menu. More... | |
bool | bGUIDrawPlayerModeSelection (player_mode_t *playerMode) |
Draw the player-mode selection in Main Menu. More... | |
bool | bGUIDrawRotationSelection (rotation_t *rotationMode) |
Draw rotation-mode selection in Main Menu. More... | |
bool | bGUIDrawLevelMenuSelection (void) |
Draws & let the player switch to the level selection/highscores screen. More... | |
void | vGUIDrawTetromino (const tetromino_t *tetromino, const image_handle_t squares[]) |
Draw the current Tetromino. More... | |
void | vGUIDrawLanded (const color_t landed[ROWS][COLS], const image_handle_t squares[]) |
Draw the array of landed tetrominos. More... | |
void | vGUIDrawNextTetromino (const tetromino_t *tetromino, const image_handle_t squares[]) |
Draw the upcoming Tetromino in the upper right corner. More... | |
void | vGUIDrawFPS (void) |
Draw an FPS counter. | |
void | vGUISetImageHandle (image_handle_t squares[]) |
Takes an image_handle_t array & initializes it with the correct images. More... | |
static void | checkDraw (uint8_t status, const char *msg) |
Check if drawing is possible. More... | |
static void | drawUserNameSelection (score_t *score, char *lastUserName) |
Draw the User-Name selection. More... | |
static void | drawHighScores (const score_t highScores[]) |
Draw the three hightest scores. More... | |
static void | drawGameModes (game_mode_t currentMode) |
Draw the available game modes. More... | |
static void | drawText (char *str, int16_t x, int16_t y, uint32_t color) |
Draw text on the screen. More... | |
Module handling the Graphical User Interface.
This module handles all functionality related to drawing/displaying things on the screen. It uses the TUM Drawing API.
bool bGUIDrawLevelMenuSelection | ( | void | ) |
#include <gui.h>
Draws & let the player switch to the level selection/highscores screen.
bool bGUIDrawLevelScreen | ( | uint8_t * | currentLevel, |
const score_t | highScores[] | ||
) |
#include <gui.h>
Draw the level selection & highscores screen.
[in] | currentLevel | (uint8_t*): The currently selected level. If no level was selected, it is 0. |
[in] | highScores | (const score_t): Array of the 3 highest scores. |
bool bGUIDrawPlayerModeSelection | ( | player_mode_t * | playerMode | ) |
#include <gui.h>
Draw the player-mode selection in Main Menu.
[in] | playerMode | ( player_mode_t *): Player mode object. |
bool bGUIDrawRotationSelection | ( | rotation_t * | rotationMode | ) |
#include <gui.h>
Draw rotation-mode selection in Main Menu.
[in] | rotationMode | ( rotation_t): Rotation mode object. |
|
static |
#include <gui.c>
Check if drawing is possible.
Checks if tumDrawing functions return 0 (success) or 1 (failure) and sends and error message in case of failure.
[in] | status | (uint8_t): Function to check. |
[in] | msg | (const char *): Error message. |
|
static |
#include <gui.c>
Draw the available game modes.
[in] | currentMode | ( game_mode_t): Currently selected game mode. |
|
static |
#include <gui.c>
Draw the three hightest scores.
[in] | highScores | (const score_t []): Sorted high-scores array. |
|
static |
#include <gui.c>
Draw text on the screen.
[in] | str | (char *): Text to draw. |
[in] | x | (int16_t): X-coordinate. |
[in] | y | (int16_t): Y-coordinate. |
[in] | color | (uint32_t): Color (HEX). |
|
static |
#include <gui.c>
Draw the User-Name selection.
Function that draws & lets the player select one of 6 usernames. Usernames are defined in the Config module.
[in,out] | score | (const score_t *): Scores to draw. |
[in] | lastUserName | (char*): Selected User-Name. |
void vGUIDrawGameOverMenu | ( | score_t * | score, |
char * | lastUserName | ||
) |
void vGUIDrawLanded | ( | const color_t | landed[ROWS][COLS], |
const image_handle_t | squares[] | ||
) |
#include <gui.h>
Draw the array of landed tetrominos.
[in] | landed | (const color_t [][]): Array of landed Tetrominos. |
[in] | squares | (const image_handle_t []): Array containing the square images. |
void vGUIDrawMainMenu | ( | game_mode_t | mode, |
player_mode_t | playerMode, | ||
rotation_t | rotationMode, | ||
bool | isConnected | ||
) |
#include <gui.h>
Draw the main menu.
If in multi-player mode, draw available game modes.
[in] | mode | ( game_mode_t): Current game mode. |
[in] | playerMode | ( player_mode_t): Current player mode (either single or multi). |
[in] | rotationMode | ( rotation_t): Current rotation mode (either left or right) . |
[in] | isConnected | (bool): Whether the opponent is connected in multi player mode. |
void vGUIDrawNextTetromino | ( | const tetromino_t * | tetromino, |
const image_handle_t | squares[] | ||
) |
#include <gui.h>
Draw the upcoming Tetromino in the upper right corner.
[in] | tetromino | (const tetromino_t *): Tetromino to draw. |
[in] | squares | (const image_handle_t): Array containing the square images. |
void vGUIDrawPauseMenu | ( | bool | isConnected | ) |
#include <gui.h>
Draw the Pause Menu.
If the player pressed "Esc" while playing, this menu is shown.
[in] | isConnected | (bool): If the connection was established in multi-player mode. |
void vGUIDrawStatic | ( | const image_handle_t | squares[], |
const score_t * | score | ||
) |
#include <gui.h>
Draw the wall, score, level & number of lines completed.
[in] | squares | (const image_handle_t): Array containing the square images. |
[in] | score | (const score_t): Score object |
void vGUIDrawTetromino | ( | const tetromino_t * | tetromino, |
const image_handle_t | squares[] | ||
) |
#include <gui.h>
Draw the current Tetromino.
Iterate through the Tetrominos's shape array and draw each existing entry in the Tetromino's color.
[in] | tetromino | (const tetromino_t *): Tetromino object to draw. |
[in] | squares | (const image_handle_t []): Array containing the square images. |
void vGUISetImageHandle | ( | image_handle_t | squares[] | ) |
#include <gui.h>
Takes an image_handle_t array & initializes it with the correct images.
[out] | squares | ( image_handle_t []): Array to initialize |