Last active
August 29, 2015 14:21
-
-
Save Aracturat/2ab9529fb2303fe4dc99 to your computer and use it in GitHub Desktop.
Narko Life
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void MainWindow::updateView() | |
{ | |
for (int x = 0; x < world -> getHeight(); x++) | |
{ | |
for(int y = 0; y < world -> getWidth(); y++) | |
{ | |
if (world -> getStatusOfCell(x, y)) { | |
pushButton[x*world->getHeight() + y]->setGeometry(x*BUTTON_HEIGHT, y*BUTTON_WIDTH, std::rand() % BUTTON_HEIGHT, std::rand() % BUTTON_WIDTH); | |
QString r = QString::number(std::rand() % 256, 16); | |
QString g = QString::number(std::rand() % 256, 16); | |
QString b = QString::number(std::rand() % 256, 16); | |
QString color = "\"#" + r + g + b + "\""; | |
setButtonColor(pushButtons[x*world->getHeight() + y], color); | |
} | |
else { | |
setButtonColor(pushButtons[x*world->getHeight() + y], QString::fromStdString(deathColor)); | |
} | |
} | |
} | |
setLabelAliveNumber(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment