Skip to content

Commit

Permalink
counts num of flags placed
Browse files Browse the repository at this point in the history
  • Loading branch information
EAOZONE committed Apr 19, 2024
1 parent 78723ea commit 3053d71
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions GameWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class GameWindow{
int numOfCols;
int numOfRows;
int numOfBombs;
int numOfFlagsPlaced;
string PlayerName;
sf::Font font;
bool gameActive;
Expand Down Expand Up @@ -47,9 +48,13 @@ class GameWindow{
window.draw(pausePlayButton.sprite);
window.draw(leaderBoard.sprite);
window.draw(faceButton.sprite);
numOfFlagsPlaced = 0;
for(int i = 0; i < numOfCols; i++){
for(int j = 0; j < numOfRows; j++) {
window.draw(board.getBoard()[i][j]->sprite);
if(board.getBoard()[i][j]->getState() == flag){
numOfFlagsPlaced++;
}
}
}
if (sf::Mouse().isButtonPressed(Mouse::Right) && !rightButtonPressed) {
Expand Down

0 comments on commit 3053d71

Please sign in to comment.