forgot something
This commit is contained in:
parent
a3e80d0b43
commit
e2f3dfb1b0
@ -19,7 +19,7 @@ void startGame(Board &board)
|
|||||||
bool gameRunning = true;
|
bool gameRunning = true;
|
||||||
|
|
||||||
time_t startTime = time(nullptr);
|
time_t startTime = time(nullptr);
|
||||||
int elapsedTime;
|
int elapsedTime = 0;
|
||||||
|
|
||||||
bool isPaused = false;
|
bool isPaused = false;
|
||||||
time_t startPauseTime = 0;
|
time_t startPauseTime = 0;
|
||||||
@ -27,11 +27,14 @@ void startGame(Board &board)
|
|||||||
time_t totalpausetime = 0;
|
time_t totalpausetime = 0;
|
||||||
while (gameRunning)
|
while (gameRunning)
|
||||||
{
|
{
|
||||||
|
|
||||||
usleep((1000 / MAX_TIME) * 1000);
|
usleep((1000 / MAX_TIME) * 1000);
|
||||||
if (board.isGameOver() || board.isGameWon())
|
if (board.isGameOver() || board.isGameWon())
|
||||||
{
|
{
|
||||||
gameRunning = false;
|
gameRunning = false;
|
||||||
}
|
}
|
||||||
|
if (!isPaused)
|
||||||
|
elapsedTime = difftime(time(NULL), startTime) - totalpausetime;
|
||||||
char flags[5];
|
char flags[5];
|
||||||
char tim[5];
|
char tim[5];
|
||||||
sprintf(flags, "%03d", minesLeft);
|
sprintf(flags, "%03d", minesLeft);
|
||||||
@ -184,8 +187,6 @@ void startGame(Board &board)
|
|||||||
if (isPaused)
|
if (isPaused)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
elapsedTime = difftime(time(NULL), startTime) - totalpausetime;
|
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user