Fixing the clock signal to use GLib::Dispatcher to emit the signal so the main thread updates the clockLabel widget
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
#include <sigc++/signal.h>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
@@ -26,8 +27,8 @@ class MineField {
|
||||
int m_openCells;
|
||||
bool m_exploded;
|
||||
bool m_gameWon;
|
||||
bool m_timerRunning;
|
||||
size_t m_time;
|
||||
std::atomic_bool m_timerRunning;
|
||||
std::thread m_timerThread;
|
||||
void computeBombsNearby(int x, int y);
|
||||
void openNeighboorhood(int x, int y);
|
||||
@@ -38,6 +39,7 @@ class MineField {
|
||||
|
||||
public:
|
||||
MineField(int cols, int rows, int mines);
|
||||
~MineField();
|
||||
void initBombs(int x, int y);
|
||||
bool isBomb(int x, int y);
|
||||
bool isFlagged(int x, int y);
|
||||
@@ -49,6 +51,7 @@ public:
|
||||
int getRows() {return m_rows; };
|
||||
bool toggleFlag(int x, int y);
|
||||
int getRemainingFlags() {return m_remainingFlags; };
|
||||
size_t getCurrentTime() {return m_time; };
|
||||
int getTotalMines() {return m_totalMines; };
|
||||
void startNewGame(int cols, int rows, int mines);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user