diff --git a/NineChess/src/config.h b/NineChess/src/config.h index a9a28d11..4ee277a5 100644 --- a/NineChess/src/config.h +++ b/NineChess/src/config.h @@ -94,6 +94,9 @@ // 启动时窗口最大化 //#define SHOW_MAXIMIZED_ON_LOAD + +//#define LCD_SHOW_SCORE_INSTEAD_OF_TIME + // 不使用哈希桶 #define DISABLE_HASHBUCKET diff --git a/NineChess/src/gamecontroller.cpp b/NineChess/src/gamecontroller.cpp index dae94b36..665837c4 100644 --- a/NineChess/src/gamecontroller.cpp +++ b/NineChess/src/gamecontroller.cpp @@ -149,8 +149,10 @@ void GameController::gameReset() } } +#ifdef LCD_SHOW_SCORE_INSTEAD_OF_TIME emit time1Changed(QString::number(score1, 10)); emit time2Changed(QString::number(score2, 10)); +#endif /* LCD_SHOW_SCORE_INSTEAD_OF_TIME */ // 重置游戏 chess_.reset(); @@ -226,9 +228,11 @@ void GameController::gameReset() currentRow = 0; // 发出信号通知主窗口更新LCD显示 - //QTime qtime = QTime(0, 0, 0, 0).addMSecs(remainingTime1); - //emit time1Changed(qtime.toString("mm:ss.zzz")); - //emit time2Changed(qtime.toString("mm:ss.zzz")); +#ifndef LCD_SHOW_SCORE_INSTEAD_OF_TIME + QTime qtime = QTime(0, 0, 0, 0).addMSecs(remainingTime1); + emit time1Changed(qtime.toString("mm:ss.zzz")); + emit time2Changed(qtime.toString("mm:ss.zzz")); +#endif /* ! LCD_SHOW_SCORE_INSTEAD_OF_TIME */ // 发信号更新状态栏 message = QString::fromStdString(chess_.getTips()); @@ -538,11 +542,13 @@ void GameController::timerEvent(QTimerEvent *event) remainingTime2 = timeLimit * 60000 - remainingTime2; } - //qt1 = QTime(0, 0, 0, 0).addMSecs(remainingTime1); - //qt2 = QTime(0, 0, 0, 0).addMSecs(remainingTime2); +#ifndef LCD_SHOW_SCORE_INSTEAD_OF_TIME + qt1 = QTime(0, 0, 0, 0).addMSecs(remainingTime1); + qt2 = QTime(0, 0, 0, 0).addMSecs(remainingTime2); - //emit time1Changed(qt1.toString("mm:ss.zzz")); - //emit time2Changed(qt2.toString("mm:ss.zzz")); + emit time1Changed(qt1.toString("mm:ss.zzz")); + emit time2Changed(qt2.toString("mm:ss.zzz")); +#endif /* ! LCD_SHOW_SCORE_INSTEAD_OF_TIME */ // 如果胜负已分 if (chess_.whoWin() != NineChess::NOBODY) { @@ -565,8 +571,10 @@ void GameController::timerEvent(QTimerEvent *event) score2++; } +#ifdef LCD_SHOW_SCORE_INSTEAD_OF_TIME emit time1Changed(QString::number(score1, 10)); emit time2Changed(QString::number(score2, 10)); +#endif /* LCD_SHOW_SCORE_INSTEAD_OF_TIME */ // 播放音效 #ifndef DONOT_PLAY_WIN_SOUND