|
|
@ -14,7 +14,7 @@ void MainWindow::clearConnected(std::set<std::vector<int>> *connected) {
|
|
|
|
qApp->processEvents();
|
|
|
|
qApp->processEvents();
|
|
|
|
usleep(550000);
|
|
|
|
usleep(550000);
|
|
|
|
for (auto i = connected->begin(); i != connected->end(); i++) {
|
|
|
|
for (auto i = connected->begin(); i != connected->end(); i++) {
|
|
|
|
buttonGrid[(*i)[0]][(*i)[1]]->setEnabled(false);
|
|
|
|
//buttonGrid[(*i)[0]][(*i)[1]]->setEnabled(false);
|
|
|
|
game->deleteCell((*i)[0], (*i)[1]);
|
|
|
|
game->deleteCell((*i)[0], (*i)[1]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
refreshButtonGrid();
|
|
|
|
refreshButtonGrid();
|
|
|
@ -38,9 +38,9 @@ void MainWindow::refreshButtonGrid() {
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::bubbleUp(int row, int column) {
|
|
|
|
void MainWindow::bubbleUp(int row, int column) {
|
|
|
|
if (row > 0) {
|
|
|
|
if (row > 0) {
|
|
|
|
QPushButton *tbutton = std::move(buttonGrid[row][column]);
|
|
|
|
/*QPushButton *tbutton = std::move(buttonGrid[row][column]);
|
|
|
|
buttonGrid[row][column] = std::move(buttonGrid[row-1][column]);
|
|
|
|
buttonGrid[row][column] = std::move(buttonGrid[row-1][column]);
|
|
|
|
buttonGrid[row-1][column] = std::move(tbutton);
|
|
|
|
buttonGrid[row-1][column] = std::move(tbutton);*/
|
|
|
|
|
|
|
|
|
|
|
|
QString tcolor = game->getCell(row, column);
|
|
|
|
QString tcolor = game->getCell(row, column);
|
|
|
|
game->setCell(row, column, game->getCell(row-1, column));
|
|
|
|
game->setCell(row, column, game->getCell(row-1, column));
|
|
|
@ -48,6 +48,7 @@ void MainWindow::bubbleUp(int row, int column) {
|
|
|
|
bubbleUp(row-1, column);
|
|
|
|
bubbleUp(row-1, column);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::bubbleBoxes(std::set<std::vector<int>> *connected) {
|
|
|
|
void MainWindow::bubbleBoxes(std::set<std::vector<int>> *connected) {
|
|
|
|
usleep(400000);
|
|
|
|
usleep(400000);
|
|
|
|
for (auto i = connected->begin(); i != connected->end(); i++) {
|
|
|
|
for (auto i = connected->begin(); i != connected->end(); i++) {
|
|
|
@ -58,11 +59,13 @@ void MainWindow::bubbleBoxes(std::set<std::vector<int>> *connected) {
|
|
|
|
|
|
|
|
|
|
|
|
// slots
|
|
|
|
// slots
|
|
|
|
void MainWindow::buttonPressed(int row, int column) {
|
|
|
|
void MainWindow::buttonPressed(int row, int column) {
|
|
|
|
|
|
|
|
if(game->getCell(row, column) != "") {
|
|
|
|
std::set<std::vector<int>> connected;
|
|
|
|
std::set<std::vector<int>> connected;
|
|
|
|
game->getConnected(&connected, game->getCell(row, column), row, column);
|
|
|
|
game->getConnected(&connected, game->getCell(row, column), row, column);
|
|
|
|
if ( connected.size() > 1) {
|
|
|
|
if ( connected.size() > 1) {
|
|
|
|
clearConnected(&connected);
|
|
|
|
clearConnected(&connected);
|
|
|
|
bubbleBoxes(&connected);
|
|
|
|
bubbleBoxes(&connected);
|
|
|
|
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
} else
|
|
|
|
ui->statusBar->showMessage("Only friends get Stars!", 2000);
|
|
|
|
ui->statusBar->showMessage("Only friends get Stars!", 2000);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -139,6 +142,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|
|
|
this->setPalette(pal);
|
|
|
|
this->setPalette(pal);
|
|
|
|
ui->menuPlay->setPalette(pal);
|
|
|
|
ui->menuPlay->setPalette(pal);
|
|
|
|
ui->menuBar->setStyleSheet("QMenuBar::item {color: #a4133c}");
|
|
|
|
ui->menuBar->setStyleSheet("QMenuBar::item {color: #a4133c}");
|
|
|
|
|
|
|
|
ui->statusBar->setStyleSheet("color: #a4133c");
|
|
|
|
refreshSizes();
|
|
|
|
refreshSizes();
|
|
|
|
game = new SameGame(rows, columns);
|
|
|
|
game = new SameGame(rows, columns);
|
|
|
|
initialiseGame();
|
|
|
|
initialiseGame();
|
|
|
|