Implemented time and status bar with colors
This commit is contained in:
22
src/game.h
22
src/game.h
@@ -23,11 +23,17 @@
|
||||
#define TFT_GAME_FIELD_LEFT 5
|
||||
#define TFT_GAME_FIELD_RIGHT 5
|
||||
#define TFT_GAME_FIELD_START_OFFSET 10
|
||||
#define TFT_GAME_HEADER_TIME_X 5
|
||||
#define TFT_GAME_HEADER_TIME_Y 3
|
||||
#define TFT_GAME_HEADER_PLAYER_X 100
|
||||
#define TFT_GAME_HEADER_PLAYER_Y 3
|
||||
#define TFT_GAME_HEADER_PLAYER_WIDTH 100
|
||||
|
||||
typedef struct game_s{
|
||||
//public section
|
||||
|
||||
uint16_t time; // seconds since game start
|
||||
uint16_t ticks_per_sec;
|
||||
int8_t winner_id;
|
||||
uint8_t ticks_per_pixel;
|
||||
player_t player[PLAYER_COUNT];
|
||||
@@ -40,19 +46,21 @@ typedef struct game_s{
|
||||
|
||||
//private section ahead:
|
||||
uint8_t ticks_leftover;
|
||||
uint8_t ticks_sum_sec;
|
||||
} game_t;
|
||||
|
||||
/**
|
||||
@brief Initializes the game object
|
||||
@param game
|
||||
@brief Initializes the game object
|
||||
@param game
|
||||
@param ticks_per_sec
|
||||
*/
|
||||
void game_init(game_t* game);
|
||||
void game_init(game_t* game, uint16_t ticks_per_sec);
|
||||
|
||||
/**
|
||||
@brief Calculates one step of the game
|
||||
@param game Game to calculate a step for
|
||||
@param deltaTime Time that passed since the last call to this method (in ticks)
|
||||
@return true if the next call to this method should be made with a delta time of zero.
|
||||
@brief Calculates one step of the game
|
||||
@param game Game to calculate a step for
|
||||
@param deltaTime Time that passed since the last call to this method (in ticks)
|
||||
@return true if the next call to this method should be made with a delta time of zero.
|
||||
|
||||
*/
|
||||
bool game_step(game_t* game, uint64_t deltaTime);
|
||||
|
||||
Reference in New Issue
Block a user