summaryrefslogtreecommitdiff
path: root/src/View/MainWindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/View/MainWindow.cpp')
-rw-r--r--src/View/MainWindow.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/View/MainWindow.cpp b/src/View/MainWindow.cpp
index 3a61068..6152fa3 100644
--- a/src/View/MainWindow.cpp
+++ b/src/View/MainWindow.cpp
@@ -142,19 +142,20 @@ void MainWindow::drawCell(int x, int y, int value){
text.setCharacterSize(fontSize);
text.setString(valueString);
if(value==2 || value==4)
- text.setColor(m_skin.at(3));
+ text.setColor(m_skin.at(12));
else
- text.setColor(m_skin.at(4));
+ text.setColor(m_skin.at(13));
text.setPosition(fontX,fontY);
if(value != 0)
RenderWindow::draw(text);
+
}
sf::Color MainWindow::getCellColor(int value){
//Id of the first cell color skin
- int idStart=7;
+ int idStart=15;
if(value==0){
return m_skin.at(1);
@@ -192,7 +193,7 @@ void MainWindow::drawATH(Stats stats){
text.setFont(m_font);
text.setStyle(sf::Text::Bold);
text.setCharacterSize(80);
- text.setColor(m_skin.at(3));
+ text.setColor(m_skin.at(7));
text.setPosition(titleX,titleY);
text.setString("2048");
@@ -209,14 +210,14 @@ void MainWindow::drawATH(Stats stats){
int bestScoreY=titleY+25;
sf::RectangleShape bestScoreShape(sf::Vector2f(bestScoreSizeX,bestScoreSizeY));
- bestScoreShape.setFillColor(m_skin.at(2));
+ bestScoreShape.setFillColor(m_skin.at(4));
bestScoreShape.setPosition(bestScoreX,bestScoreY);
RenderWindow::draw(bestScoreShape);
text.setString("BEST");
text.setPosition(bestScoreX+bestScoreSizeY-scoreAndBestScoreFontSize-5,bestScoreY+12);
text.setCharacterSize(scoreAndBestScoreFontSize-5);
- text.setColor(m_skin.at(7));
+ text.setColor(m_skin.at(9));
RenderWindow::draw(text);
@@ -229,7 +230,7 @@ void MainWindow::drawATH(Stats stats){
int scoreLength=std::to_string(stats.getScore()).size();
sf::RectangleShape scoreShape(sf::Vector2f(scoreSizeX,scoreSizeY));
- scoreShape.setFillColor(m_skin.at(2));
+ scoreShape.setFillColor(m_skin.at(3));
scoreShape.setPosition(scoreX,scoreY);
RenderWindow::draw(scoreShape);
@@ -237,19 +238,22 @@ void MainWindow::drawATH(Stats stats){
text.setString("SCORE");
text.setPosition(scoreX+scoreSizeY-scoreAndBestScoreFontSize-10,scoreY+12);
text.setCharacterSize(scoreAndBestScoreFontSize-5);
- text.setColor(m_skin.at(7));
+ text.setColor(m_skin.at(8));
RenderWindow::draw(text);
text.setString(std::to_string(stats.getScore()));
text.setPosition(scoreX+scoreSizeY-((scoreLength+20)/2)-scoreAndBestScoreFontSize+10,scoreY+scoreSizeY - scoreAndBestScoreFontSize-10);
text.setCharacterSize(scoreAndBestScoreFontSize);
- text.setColor(sf::Color::White);
+ text.setColor(m_skin.at(10));
RenderWindow::draw(text);
}
void MainWindow::drawGame(std::vector<std::vector<int> > grid, bool gameIsOver, Stats stats){
+#ifdef LIVESKINNING
+ m_skin=skin::loadSkin(m_skinName);
+#endif
this->drawGrid(grid,gameIsOver);
this->drawATH(stats);
}