|
|
@ -4,9 +4,14 @@
|
|
|
|
extern std::unique_ptr<QSettings> settings;
|
|
|
|
extern std::unique_ptr<QSettings> settings;
|
|
|
|
|
|
|
|
|
|
|
|
// slots
|
|
|
|
// slots
|
|
|
|
void MainWindow::buttonPressed(QPushButton *button, int row, int column) {
|
|
|
|
void MainWindow::buttonPressed(int row, int column) {
|
|
|
|
QString text = "\u2605";
|
|
|
|
QString text = "\u2605";
|
|
|
|
button->setText(text);
|
|
|
|
std::set<std::vector<int>> connected;
|
|
|
|
|
|
|
|
game->getConnected(&connected, game->getCell(row, column), row, column);
|
|
|
|
|
|
|
|
for (auto i = connected.begin(); i != connected.end(); i++) {
|
|
|
|
|
|
|
|
buttonGrid[(*i)[0]][(*i)[1]]->setText(text);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//button->setText(text);
|
|
|
|
//buttonGrid[row][column+1 % columns]->setText(text);
|
|
|
|
//buttonGrid[row][column+1 % columns]->setText(text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -28,6 +33,7 @@ void MainWindow::initialiseGame() {
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::initialiseGameGrid() {
|
|
|
|
void MainWindow::initialiseGameGrid() {
|
|
|
|
QSize button_size(max_width/columns, max_height/rows);
|
|
|
|
QSize button_size(max_width/columns, max_height/rows);
|
|
|
|
|
|
|
|
buttonGrid.clear();
|
|
|
|
|
|
|
|
|
|
|
|
for(int i = 0; i < rows; i++)
|
|
|
|
for(int i = 0; i < rows; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -43,7 +49,7 @@ void MainWindow::initialiseGameGrid() {
|
|
|
|
// Set size text etc. for each button
|
|
|
|
// Set size text etc. for each button
|
|
|
|
|
|
|
|
|
|
|
|
connect(button, &QPushButton::clicked, [=](){
|
|
|
|
connect(button, &QPushButton::clicked, [=](){
|
|
|
|
buttonPressed(button, i, j);
|
|
|
|
buttonPressed(i, j);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
buttonGrid.push_back(std::move(button_row));
|
|
|
|
buttonGrid.push_back(std::move(button_row));
|
|
|
|