mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-14 14:32:15 -07:00
Don't stop/start, just start.
Took 29 minutes
This commit is contained in:
parent
594985bf9e
commit
6d8cb36adf
2 changed files with 1 additions and 15 deletions
|
|
@ -18,6 +18,7 @@ GameState::GameState(AbstractGame *parent,
|
||||||
gameTimer = new QTimer(this);
|
gameTimer = new QTimer(this);
|
||||||
gameTimer->setInterval(1000);
|
gameTimer->setInterval(1000);
|
||||||
connect(gameTimer, &QTimer::timeout, this, &GameState::incrementGameTime);
|
connect(gameTimer, &QTimer::timeout, this, &GameState::incrementGameTime);
|
||||||
|
gameTimer->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameState::incrementGameTime()
|
void GameState::incrementGameTime()
|
||||||
|
|
@ -37,14 +38,4 @@ void GameState::setGameTime(int _secondsElapsed)
|
||||||
emit updateTimeElapsedLabel(QString::number(hours).rightJustified(2, '0') + ":" +
|
emit updateTimeElapsedLabel(QString::number(hours).rightJustified(2, '0') + ":" +
|
||||||
QString::number(minutes).rightJustified(2, '0') + ":" +
|
QString::number(minutes).rightJustified(2, '0') + ":" +
|
||||||
QString::number(seconds).rightJustified(2, '0'));
|
QString::number(seconds).rightJustified(2, '0'));
|
||||||
}
|
|
||||||
|
|
||||||
void GameState::startGameTimer()
|
|
||||||
{
|
|
||||||
gameTimer->start();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GameState::stopGameTimer()
|
|
||||||
{
|
|
||||||
gameTimer->stop();
|
|
||||||
}
|
}
|
||||||
|
|
@ -91,17 +91,12 @@ public:
|
||||||
void onStartedChanged(bool _started)
|
void onStartedChanged(bool _started)
|
||||||
{
|
{
|
||||||
if (_started) {
|
if (_started) {
|
||||||
startGameTimer();
|
|
||||||
emit gameStarted(_started);
|
emit gameStarted(_started);
|
||||||
} else {
|
} else {
|
||||||
stopGameTimer();
|
|
||||||
emit gameStopped();
|
emit gameStopped();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void startGameTimer();
|
|
||||||
void stopGameTimer();
|
|
||||||
|
|
||||||
void setGameStateKnown(bool known)
|
void setGameStateKnown(bool known)
|
||||||
{
|
{
|
||||||
gameStateKnown = known;
|
gameStateKnown = known;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue