Implented collision detection, now fully working
This commit is contained in:
23
src/game.h
23
src/game.h
@@ -3,13 +3,14 @@
|
||||
|
||||
#include<stdint.h>
|
||||
#include<stdlib.h>
|
||||
#include<stdbool.h>
|
||||
#include"player.h"
|
||||
|
||||
#define PLAYER_COUNT 2
|
||||
#define PLAYER_WIDTH 0 // Don't change
|
||||
#define SPEED_SLOW 10
|
||||
#define SPEED_FAST 1
|
||||
#define SPEED_DEFAULT (SPEED_SLOW)
|
||||
#define SPEED_DEFAULT (SPEED_FAST)
|
||||
|
||||
#define BTN_START 0
|
||||
#define BTN_PLAYER_1_LEFT 3
|
||||
@@ -17,6 +18,12 @@
|
||||
#define BTN_PLAYER_2_LEFT 1
|
||||
#define BTN_PLAYER_2_RIGHT 0
|
||||
|
||||
#define TFT_GAME_FIELD_TOP 20
|
||||
#define TFT_GAME_FIELD_BOTTOM 5
|
||||
#define TFT_GAME_FIELD_LEFT 5
|
||||
#define TFT_GAME_FIELD_RIGHT 5
|
||||
#define TFT_GAME_FIELD_START_OFFSET 10
|
||||
|
||||
typedef struct game_s{
|
||||
//public section
|
||||
|
||||
@@ -35,7 +42,19 @@ typedef struct game_s{
|
||||
uint8_t ticks_leftover;
|
||||
} game_t;
|
||||
|
||||
/**
|
||||
@brief Initializes the game object
|
||||
@param game
|
||||
*/
|
||||
void game_init(game_t* game);
|
||||
void game_step(game_t* game, uint64_t deltaTime);
|
||||
|
||||
/**
|
||||
@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);
|
||||
|
||||
#endif /* GAME_H */
|
||||
|
||||
Reference in New Issue
Block a user