mis en place la PR de simon sur les couleurs

This commit is contained in:
2025-02-28 18:42:04 +01:00
parent f0f391ade6
commit 26f501f7e8
29 changed files with 713 additions and 665 deletions

View File

@@ -4,7 +4,7 @@
#include "GameParameters.h"
#include "Action.h"
#include <Vector>
#include <vector>
/**
@@ -12,22 +12,22 @@
*/
class Game {
private:
GameParameters parameters; // the current parameters of the game
GameBoard board; // the board in which the game is played
bool started; // wheter the game has started
bool lost; // wheter the game is lost
long int score; // the current score
int framesPassed; // how many frames have passed since the start of the game
bool B2BChain; // wheter the player is currently on a B2B chain
std::set<Action> heldActions; // the list of actions that were pressed last frame
GameParameters parameters; // the current parameters of the game
GameBoard board; // the board in which the game is played
bool started; // wheter the game has started
bool lost; // wheter the game is lost
long int score; // the current score
int framesPassed; // how many frames have passed since the start of the game
bool B2BChain; // wheter the player is currently on a B2B chain
std::set<Action> heldActions; // the list of actions that were pressed last frame
std::set<Action> initialActions; // the list of actions that have been pressed while there was no active piece
int heldDAS; // the number of frames DAS has been held, positive for right or negative for left
int heldARR; // the number of frames ARR has been held
int subVerticalPosition; // how far the active piece is to go down one line
int leftARETime; // how many frames are left before ARE period finishes
int totalLockDelay; // how many frames has the active piece touched the ground without moving
int totalForcedLockDelay; // how many frames the active piece has touched the ground since the last spawned piece
int heldDAS; // the number of frames DAS has been held, positive for right or negative for left
int heldARR; // the number of frames ARR has been held
int subVerticalPosition; // how far the active piece is to go down one line
int leftARETime; // how many frames are left before ARE period finishes
int totalLockDelay; // how many frames has the active piece touched the ground without moving
int totalForcedLockDelay; // how many frames the active piece has touched the ground since the last spawned piece
public:
/**
* Initialize the parameters and creates a new board
@@ -40,85 +40,85 @@ class Game {
void start();
/**
* Advance to the next frame while excecuting the actions taken by the player,
* Advances to the next frame while excecuting the actions taken by the player,
* this is where the main game logic takes place
*/
void nextFrame(const std::set<Action>& playerActions);
private:
/**
* Move the piece in the specified direction
* Movse the piece in the specified direction
*/
void movePiece(int movement, bool resetDirection);
/**
* Locks the piece, updates level and score and spawn the next piece if necessary
* Locks the piece, updates level and score and spawns the next piece if necessary
*/
void lockPiece();
public:
/**
* Returns wheter the player has won
* @return If the player has won
*/
bool hasWon();
/**
* Returns wheter the player has lost
* @return If the player has lost
*/
bool hasLost();
/**
* Returns the current level
* @return The current level
*/
int getLevel();
/**
* Returns the current number of cleared lines
* @return The current number of cleared lines
*/
int getClearedLines();
/**
* Returns the number of frames passed since the start of the game
* @return The number of frames passed since the start of the game
*/
int getFramesPassed();
/**
* Returns the current score
* @return The current score
*/
int getScore();
/**
* Returns wheter the player is currently on a B2B chain
* @return If the player is currently on a B2B chain
*/
bool isOnB2BChain();
/**
* Returns wheter all blocks are currently bone blocks
* @return If all blocks are currently bone blocks
*/
bool areBlocksBones();
/**
* Returns a copy of the board
* @return A copy of the board
*/
Board getBoard();
/**
* Returns a copy of the active piece
* @return A copy of the active piece
*/
Piece getActivePiece();
/**
* Returns a copy of the active piece position
* @return A copy of the active piece position
*/
Cell getActivePiecePosition();
Position getActivePiecePosition();
/**
* Returns a copy of the held piece
* @return A copy of the held piece
*/
Piece getHeldPiece();
/**
* Return a copy of the next pieces queue
* @return A copy of the next pieces queue
*/
std::vector<Piece> getNextPieces();
};