From 6b37ae07ffe0d233b7ff54558d7d39e3e9035e0d Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Sun, 3 May 2015 20:23:43 +0200 Subject: Add font and fast programming to test the game --- src/Model/Game.cpp | 9 +++++++++ src/Model/Game.hpp | 2 ++ src/Model/Grid.cpp | 5 +++++ src/Model/Grid.hpp | 3 ++- 4 files changed, 18 insertions(+), 1 deletion(-) (limited to 'src/Model') diff --git a/src/Model/Game.cpp b/src/Model/Game.cpp index 284d82b..e2ac799 100644 --- a/src/Model/Game.cpp +++ b/src/Model/Game.cpp @@ -83,3 +83,12 @@ int Game::getScore(){ int Game::getNbMove(){ return m_nbMove; } + +std::vector > Game::getGrid(){ + return m_grid.getGrid(); +} + + +int Game::maxStrLenInGrid(){ + return m_grid.maxStrLenInGrid(); +} diff --git a/src/Model/Game.hpp b/src/Model/Game.hpp index 0b2ee4d..e5d19e5 100644 --- a/src/Model/Game.hpp +++ b/src/Model/Game.hpp @@ -35,6 +35,8 @@ class Game //Getters and Setters int getScore(); int getNbMove(); + int maxStrLenInGrid(); + std::vector > getGrid(); }; #endif diff --git a/src/Model/Grid.cpp b/src/Model/Grid.cpp index cc0fe60..7d23c6c 100644 --- a/src/Model/Grid.cpp +++ b/src/Model/Grid.cpp @@ -345,3 +345,8 @@ std::vector Grid::getCol(int col){ return colVect; } + + +std::vector > Grid::getGrid(){ + return m_grid; +} diff --git a/src/Model/Grid.hpp b/src/Model/Grid.hpp index 51168a9..604a6ff 100644 --- a/src/Model/Grid.hpp +++ b/src/Model/Grid.hpp @@ -21,7 +21,6 @@ class Grid int m_lastMoveScore; //Private methods - int maxStrLenInGrid(); public: //Constructor and Destructor @@ -34,6 +33,7 @@ class Grid std::vector rightMerge(std::vector line); std::vector leftMerge(std::vector line); + int maxStrLenInGrid(); //Swipe methods bool swipeRight(); bool swipeLeft(); @@ -55,6 +55,7 @@ class Grid std::vector getCol(int col); void setCol(int col, std::vector colVect); int getLastMoveScore(); + std::vector > getGrid(); }; -- cgit v1.2.3 From 3384204edca8720958b7d20c72956037b03238ae Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Mon, 4 May 2015 12:55:15 +0200 Subject: Clear some things --- src/Controllers/SFMLController/SFMLController.cpp | 3 +- src/Model/Grid.cpp | 1 + src/View/MainWindow.cpp | 118 +++++++++++++++++----- src/View/MainWindow.hpp | 17 +++- 4 files changed, 109 insertions(+), 30 deletions(-) (limited to 'src/Model') diff --git a/src/Controllers/SFMLController/SFMLController.cpp b/src/Controllers/SFMLController/SFMLController.cpp index e037c0b..3d5d4a1 100644 --- a/src/Controllers/SFMLController/SFMLController.cpp +++ b/src/Controllers/SFMLController/SFMLController.cpp @@ -56,7 +56,8 @@ void SFMLController::run(){ m_MainWindow.clearBG(); //m_game.swipe(kbdh::Direction::Left); - m_MainWindow.drawGrid(m_game.getGrid()); + std::vector > aaa=m_game.getGrid(); + m_MainWindow.drawGrid(aaa,m_game.isOver()); m_MainWindow.display(); //keyPress=this->waitArrowKeyPress(); diff --git a/src/Model/Grid.cpp b/src/Model/Grid.cpp index 7d23c6c..64d8048 100644 --- a/src/Model/Grid.cpp +++ b/src/Model/Grid.cpp @@ -11,6 +11,7 @@ Grid::Grid(): m_size(4), m_grid(4){ m_grid.at(i).push_back(0); } } + //m_grid.at(3).at(0)=2048; } //Destructor diff --git a/src/View/MainWindow.cpp b/src/View/MainWindow.cpp index 784effb..659450f 100644 --- a/src/View/MainWindow.cpp +++ b/src/View/MainWindow.cpp @@ -8,19 +8,31 @@ MainWindow::MainWindow(int width, int height, std::string title): RenderWindow(sf::VideoMode(width,height), title,sf::Style::Titlebar | sf::Style::Close), m_skin(), - m_windowMargin(10), - m_sizeCell(120), - m_spaceBetweenCell(10) + m_windowSize(), + m_cellSize(105,105), + m_gridSize(0,0), + m_gridPosition(), + m_spaceBetweenCell(15), + m_font() { //Set windows size m_windowSize=RenderWindow::getSize(); + + m_gridPosition=sf::Vector2u(50,200); + + + + //Load font + m_font.loadFromFile("./src/skin/original/Pragmatica-Medium.ttf"); //Define original skin: m_skin.push_back(sf::Color(250,248,239)); //Background MainWindow m_skin.push_back(sf::Color(205,192,180)); //Background cells m_skin.push_back(sf::Color(187,173,160)); //Background grid color m_skin.push_back(sf::Color(119,110,101)); //2 and 4 font color + m_skin.push_back(sf::Color(143,122,102)); //Button color m_skin.push_back(sf::Color(249,246,242)); //other number font Color + m_skin.push_back(sf::Color(238,228,218,186)); //Game over color bg //Skin 2 et le 4 m_skin.push_back(sf::Color(238,228,218)); //2 @@ -53,36 +65,46 @@ void MainWindow::clearBG(){ } -void MainWindow::drawGrid(std::vector > grid){ +void MainWindow::drawGrid(std::vector > grid, bool gameIsOver){ - //Usefull variable - int centerOffset=(m_windowSize.x-(3*m_spaceBetweenCell+4*m_sizeCell))/2; - int distanceBetweenTopAndGrid=180; - int gridsize=3*m_spaceBetweenCell + 4*m_sizeCell + 2*m_spaceBetweenCell; //First draw the grid - sf::RectangleShape gridBG(sf::Vector2f(gridsize, gridsize)); - gridBG.setFillColor(m_skin.at(2)); - gridBG.setPosition(centerOffset-m_spaceBetweenCell,distanceBetweenTopAndGrid - m_spaceBetweenCell); - RenderWindow::draw(gridBG); + int gridX=m_gridPosition.x; + int gridY=m_gridPosition.y; + + m_gridSize.x=(grid.at(0).size()*m_cellSize.x)+(grid.at(0).size()*m_spaceBetweenCell)+m_spaceBetweenCell; + m_gridSize.y=(grid.size()*m_cellSize.y)+(grid.size()*m_spaceBetweenCell)+m_spaceBetweenCell; + + //Draw the grid + sf::RectangleShape gridShape(sf::Vector2f(m_gridSize.x,m_gridSize.y)); + gridShape.setFillColor(m_skin.at(2)); + gridShape.setPosition(gridX,gridY); + RenderWindow::draw(gridShape); + + for(int i=0;idrawCell(x,y,value); + + this->drawCell(cellX,cellY,value); + } } + + if(gameIsOver) + this->drawGameOver(gridX,gridY); + this->drawATH(); } void MainWindow::drawCell(int x, int y, int value){ //Init RectangleShape - sf::RectangleShape cell(sf::Vector2f(m_sizeCell, m_sizeCell)); + sf::RectangleShape cell(sf::Vector2f(m_cellSize.x, m_cellSize.y)); //Define color, checking skin cell.setFillColor(this->getCellColor(value)); @@ -99,18 +121,20 @@ void MainWindow::drawCell(int x, int y, int value){ std::string valueString(valueStream.str()); - int fontSize(m_sizeCell/2); + int fontSize(m_cellSize.x/2); + int fontSizeFact=15; + if(value>=1024) + fontSize-=fontSizeFact; int valueSize(valueString.size()); - int fontX=x+(m_sizeCell/2)-((valueSize*(fontSize-20))/2); - int fontY=y+(m_sizeCell/2)-(fontSize/2)-10; + int fontX=x+(m_cellSize.x/2)-((valueSize*(fontSize-20))/2); + int fontY=y+(m_cellSize.y/2)-(fontSize/2)-10; - sf::Font font; - font.loadFromFile("./src/skin/original/Pragmatica-Medium.ttf"); sf::Text text; - text.setFont(font); + text.setFont(m_font); + text.setStyle(sf::Text::Bold); text.setCharacterSize(fontSize); text.setString(valueString); if(value==2 || value==4) @@ -126,7 +150,7 @@ void MainWindow::drawCell(int x, int y, int value){ sf::Color MainWindow::getCellColor(int value){ //Id of the first cell color skin - int idStart=5; + int idStart=7; if(value==0){ return m_skin.at(1); @@ -144,4 +168,48 @@ sf::Color MainWindow::getCellColor(int value){ return m_skin.at(idStart+11); } +void MainWindow::drawGameOver(int gridX, int gridY){ + + sf::RectangleShape gridShape(sf::Vector2f(m_gridSize.x,m_gridSize.y)); + gridShape.setFillColor(m_skin.at(6)); + gridShape.setPosition(gridX,gridY); + RenderWindow::draw(gridShape); +} + + +void MainWindow::drawATH(){ + int titleX=m_gridPosition.x; + int titleY=m_gridPosition.y-190; + + + //==================== Draw title ==================== + sf::Text text; + text.setFont(m_font); + text.setStyle(sf::Text::Bold); + text.setCharacterSize(80); + text.setColor(m_skin.at(3)); + text.setPosition(titleX,titleY); + text.setString("2048"); + + RenderWindow::draw(text); + + + //==================== Draw score ==================== + + int scoreSizeX=110; + int scoreX=m_gridPosition.x+m_gridSize.x-scoreSizeX; + + sf::RectangleShape scoreShape(sf::Vector2f(scoreSizeX,60)); + scoreShape.setFillColor(m_skin.at(2)); + scoreShape.setPosition(scoreX,titleY+25); + RenderWindow::draw(scoreShape); + + //==================== Draw best score ==================== + + + sf::RectangleShape bestScoreShape(sf::Vector2f(scoreSizeX,60)); + bestScoreShape.setFillColor(m_skin.at(2)); + bestScoreShape.setPosition(scoreX-scoreSizeX-5,titleY+25); + RenderWindow::draw(bestScoreShape); +} diff --git a/src/View/MainWindow.hpp b/src/View/MainWindow.hpp index aabdb09..729b961 100644 --- a/src/View/MainWindow.hpp +++ b/src/View/MainWindow.hpp @@ -13,19 +13,28 @@ class MainWindow : public sf::RenderWindow{ private: std::vector m_skin; - int m_windowMargin; - int m_sizeCell; - int m_spaceBetweenCell; + //int m_windowMargin; + //int m_sizeCell; + + sf::Font m_font; + //Coordonates sf::Vector2u m_windowSize; + sf::Vector2u m_gridSize; + sf::Vector2u m_cellSize; + + sf::Vector2u m_gridPosition; + int m_spaceBetweenCell; public: MainWindow(int width, int height, std::string title); ~MainWindow(); void clearBG(); - void drawGrid(std::vector > grid); + void drawGrid(std::vector > grid, bool gameIsOver); void drawCell(int x, int y, int value); sf::Color getCellColor(int value); + void drawGameOver(int gridX, int griY); + void drawATH(); }; -- cgit v1.2.3 From 1bebaf0f924c83bfb5a91bafefcb69d98e3b8b05 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Mon, 4 May 2015 13:08:45 +0200 Subject: Prefer extends Game to grid than encapsulation --- src/Model/Game.cpp | 36 ++++++++++++++++++------------------ src/Model/Game.hpp | 10 +++++----- src/Model/Grid.hpp | 3 ++- 3 files changed, 25 insertions(+), 24 deletions(-) (limited to 'src/Model') diff --git a/src/Model/Game.cpp b/src/Model/Game.cpp index e2ac799..9c67184 100644 --- a/src/Model/Game.cpp +++ b/src/Model/Game.cpp @@ -4,7 +4,7 @@ //==================== Constructor and Destructor ==================== //Constructor -Game::Game() : m_grid(), m_score(0), m_nbMove(0){ +Game::Game() : Grid(), m_nbMove(0), m_score(0){ } //Destructor @@ -21,21 +21,21 @@ bool Game::swipe(kbdh::Direction direction){ switch(direction){ case kbdh::Left: - moveDone=m_grid.swipeLeft(); + moveDone=swipeLeft(); break; case kbdh::Right: - moveDone=m_grid.swipeRight(); + moveDone=swipeRight(); break; case kbdh::Up: - moveDone=m_grid.swipeUp(); + moveDone=swipeUp(); break; case kbdh::Down: - moveDone=m_grid.swipeDown(); + moveDone=swipeDown(); break; } if(moveDone){ - m_score+=m_grid.getLastMoveScore(); + m_score+=m_lastMoveScore; m_nbMove++; this->popRandomNumber(); } @@ -46,17 +46,17 @@ bool Game::swipe(kbdh::Direction direction){ //Cout the grid void Game::coutGrid(){ - std::cout << m_grid.description(); + std::cout << this->description(); } //Return true if the game is lost. False else. -bool Game::isOver(){ - return m_grid.isOver(); -} +//bool Game::isOver(){ + //return m_grid.isOver(); +//} //Pop a random number on the grid void Game::popRandomNumber(){ - std::tuple coord(m_grid.getRandomEmptyCellCoord()); + std::tuple coord(Grid::getRandomEmptyCellCoord()); int percent=rand() % 100; @@ -70,7 +70,7 @@ void Game::popRandomNumber(){ } - m_grid.setCell(coord, number); + Grid::setCell(coord, number); } //==================== Getters and Setter ==================== @@ -84,11 +84,11 @@ int Game::getNbMove(){ return m_nbMove; } -std::vector > Game::getGrid(){ - return m_grid.getGrid(); -} +//std::vector > Game::getGrid(){ + //return m_grid.getGrid(); +//} -int Game::maxStrLenInGrid(){ - return m_grid.maxStrLenInGrid(); -} +//int Game::maxStrLenInGrid(){ + //return m_grid.maxStrLenInGrid(); +//} diff --git a/src/Model/Game.hpp b/src/Model/Game.hpp index e5d19e5..77be7d7 100644 --- a/src/Model/Game.hpp +++ b/src/Model/Game.hpp @@ -13,11 +13,11 @@ #include "Grid.hpp" #include -class Game +class Game : public Grid { private: //Members - Grid m_grid; + //Grid m_grid; int m_score; int m_nbMove; @@ -30,13 +30,13 @@ class Game bool swipe(kbdh::Direction direction); void coutGrid(); void popRandomNumber(); - bool isOver(); + //bool isOver(); //Getters and Setters int getScore(); int getNbMove(); - int maxStrLenInGrid(); - std::vector > getGrid(); + //int maxStrLenInGrid(); + //std::vector > getGrid(); }; #endif diff --git a/src/Model/Grid.hpp b/src/Model/Grid.hpp index 604a6ff..22416b0 100644 --- a/src/Model/Grid.hpp +++ b/src/Model/Grid.hpp @@ -16,8 +16,9 @@ class Grid { private: //Members - int m_size; + protected: std::vector > m_grid; + int m_size; int m_lastMoveScore; //Private methods -- cgit v1.2.3 From 164d94eec1b88f0e9a466585b512fc8dca4c80ed Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Mon, 4 May 2015 14:00:54 +0200 Subject: Add stats class, make a functionnal SFML game --- src/Controllers/SFMLController/SFMLController.cpp | 2 +- src/Model/CMakeLists.txt | 2 +- src/Model/Game.cpp | 14 ++--- src/Model/Game.hpp | 8 +-- src/Model/Stats.cpp | 29 ++++++++++ src/Model/Stats.hpp | 30 ++++++++++ src/View/MainWindow.cpp | 68 ++++++++++++++++++----- src/View/MainWindow.hpp | 5 +- 8 files changed, 127 insertions(+), 31 deletions(-) create mode 100644 src/Model/Stats.cpp create mode 100644 src/Model/Stats.hpp (limited to 'src/Model') diff --git a/src/Controllers/SFMLController/SFMLController.cpp b/src/Controllers/SFMLController/SFMLController.cpp index 3d5d4a1..bf4a069 100644 --- a/src/Controllers/SFMLController/SFMLController.cpp +++ b/src/Controllers/SFMLController/SFMLController.cpp @@ -57,7 +57,7 @@ void SFMLController::run(){ m_MainWindow.clearBG(); //m_game.swipe(kbdh::Direction::Left); std::vector > aaa=m_game.getGrid(); - m_MainWindow.drawGrid(aaa,m_game.isOver()); + m_MainWindow.drawGame(aaa,m_game.isOver(), m_game.getStats()); m_MainWindow.display(); //keyPress=this->waitArrowKeyPress(); diff --git a/src/Model/CMakeLists.txt b/src/Model/CMakeLists.txt index 888589e..4ebe544 100644 --- a/src/Model/CMakeLists.txt +++ b/src/Model/CMakeLists.txt @@ -1,2 +1,2 @@ #Make Model lib -add_library(Model Grid.cpp Game.cpp) +add_library(Model Grid.cpp Game.cpp Stats.cpp) diff --git a/src/Model/Game.cpp b/src/Model/Game.cpp index 9c67184..5781f54 100644 --- a/src/Model/Game.cpp +++ b/src/Model/Game.cpp @@ -4,7 +4,7 @@ //==================== Constructor and Destructor ==================== //Constructor -Game::Game() : Grid(), m_nbMove(0), m_score(0){ +Game::Game() : Grid(), m_stats(){ } //Destructor @@ -35,8 +35,8 @@ bool Game::swipe(kbdh::Direction direction){ } if(moveDone){ - m_score+=m_lastMoveScore; - m_nbMove++; + m_stats.incScore(m_lastMoveScore); + m_stats.incnbMove(); this->popRandomNumber(); } @@ -75,14 +75,10 @@ void Game::popRandomNumber(){ //==================== Getters and Setter ==================== //Retrieve the Score -int Game::getScore(){ - return m_score; +Stats Game::getStats(){ + return m_stats; } -//Retrieve the number of moves -int Game::getNbMove(){ - return m_nbMove; -} //std::vector > Game::getGrid(){ //return m_grid.getGrid(); diff --git a/src/Model/Game.hpp b/src/Model/Game.hpp index 77be7d7..e468176 100644 --- a/src/Model/Game.hpp +++ b/src/Model/Game.hpp @@ -11,6 +11,7 @@ #include #include "../Helpers/Keyboard.hpp" #include "Grid.hpp" +#include "Stats.hpp" #include class Game : public Grid @@ -18,9 +19,7 @@ class Game : public Grid private: //Members //Grid m_grid; - int m_score; - int m_nbMove; - + Stats m_stats; public: //Constructor and Destructor Game(); @@ -33,8 +32,7 @@ class Game : public Grid //bool isOver(); //Getters and Setters - int getScore(); - int getNbMove(); + Stats getStats(); //int maxStrLenInGrid(); //std::vector > getGrid(); }; diff --git a/src/Model/Stats.cpp b/src/Model/Stats.cpp new file mode 100644 index 0000000..8bada78 --- /dev/null +++ b/src/Model/Stats.cpp @@ -0,0 +1,29 @@ +#include "Stats.hpp" + + +Stats::Stats() : + m_score(0), + m_nbMove(0) +{ + +} + +Stats::~Stats(){ +} + + + +void Stats::incScore(int value){ + m_score+=value; +} +void Stats::incnbMove(){ + m_nbMove++; +} + + +int Stats::getScore(){ + return m_score; +} +int Stats::getNbMove(){ + return m_nbMove; +} diff --git a/src/Model/Stats.hpp b/src/Model/Stats.hpp new file mode 100644 index 0000000..49c7356 --- /dev/null +++ b/src/Model/Stats.hpp @@ -0,0 +1,30 @@ +#ifndef __STATS__ +#define __STATS__ + +#include + + + + + +class Stats{ + + private: + int m_score; + int m_nbMove; + public: + + Stats(); + ~Stats(); + void incScore(int value); + void incnbMove(); + + + int getScore(); + int getNbMove(); + + + +}; + +#endif diff --git a/src/View/MainWindow.cpp b/src/View/MainWindow.cpp index 659450f..23b8677 100644 --- a/src/View/MainWindow.cpp +++ b/src/View/MainWindow.cpp @@ -18,7 +18,7 @@ MainWindow::MainWindow(int width, int height, std::string title): //Set windows size m_windowSize=RenderWindow::getSize(); - m_gridPosition=sf::Vector2u(50,200); + m_gridPosition=sf::Vector2u(0,200); @@ -75,6 +75,11 @@ void MainWindow::drawGrid(std::vector > grid, bool gameIsOver){ m_gridSize.x=(grid.at(0).size()*m_cellSize.x)+(grid.at(0).size()*m_spaceBetweenCell)+m_spaceBetweenCell; m_gridSize.y=(grid.size()*m_cellSize.y)+(grid.size()*m_spaceBetweenCell)+m_spaceBetweenCell; + //Center: + m_gridPosition.x=m_windowSize.x/2-m_gridSize.x/2; + m_gridPosition.y=220; + + //Draw the grid sf::RectangleShape gridShape(sf::Vector2f(m_gridSize.x,m_gridSize.y)); gridShape.setFillColor(m_skin.at(2)); @@ -97,7 +102,6 @@ void MainWindow::drawGrid(std::vector > grid, bool gameIsOver){ if(gameIsOver) this->drawGameOver(gridX,gridY); - this->drawATH(); } @@ -177,7 +181,7 @@ void MainWindow::drawGameOver(int gridX, int gridY){ } -void MainWindow::drawATH(){ +void MainWindow::drawATH(Stats stats){ int titleX=m_gridPosition.x; int titleY=m_gridPosition.y-190; @@ -195,21 +199,57 @@ void MainWindow::drawATH(){ RenderWindow::draw(text); - //==================== Draw score ==================== + //==================== Draw best score ==================== + + int scoreAndBestScoreFontSize(20); - int scoreSizeX=110; - int scoreX=m_gridPosition.x+m_gridSize.x-scoreSizeX; + int bestScoreSizeX=110; + int bestScoreSizeY=60; + int bestScoreX=m_gridPosition.x+m_gridSize.x-bestScoreSizeX; + int bestScoreY=titleY+25; + + sf::RectangleShape bestScoreShape(sf::Vector2f(bestScoreSizeX,bestScoreSizeY)); + bestScoreShape.setFillColor(m_skin.at(2)); + 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)); + + RenderWindow::draw(text); + + //==================== Draw score ==================== + + int scoreX=bestScoreX-bestScoreSizeX-5; + int scoreY=bestScoreY; + int scoreSizeX=bestScoreSizeX; + int scoreSizeY=bestScoreSizeY; + int scoreLength=std::to_string(stats.getScore()).size(); - sf::RectangleShape scoreShape(sf::Vector2f(scoreSizeX,60)); + sf::RectangleShape scoreShape(sf::Vector2f(scoreSizeX,scoreSizeY)); scoreShape.setFillColor(m_skin.at(2)); - scoreShape.setPosition(scoreX,titleY+25); + scoreShape.setPosition(scoreX,scoreY); RenderWindow::draw(scoreShape); - //==================== Draw best score ==================== - - sf::RectangleShape bestScoreShape(sf::Vector2f(scoreSizeX,60)); - bestScoreShape.setFillColor(m_skin.at(2)); - bestScoreShape.setPosition(scoreX-scoreSizeX-5,titleY+25); - RenderWindow::draw(bestScoreShape); + text.setString("SCORE"); + text.setPosition(scoreX+scoreSizeY-scoreAndBestScoreFontSize-10,scoreY+12); + text.setCharacterSize(scoreAndBestScoreFontSize-5); + text.setColor(m_skin.at(7)); + + 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); + + RenderWindow::draw(text); +} + +void MainWindow::drawGame(std::vector > grid, bool gameIsOver, Stats stats){ + this->drawGrid(grid,gameIsOver); + this->drawATH(stats); } diff --git a/src/View/MainWindow.hpp b/src/View/MainWindow.hpp index 729b961..072a7ec 100644 --- a/src/View/MainWindow.hpp +++ b/src/View/MainWindow.hpp @@ -5,6 +5,7 @@ #include #include #include +#include "../Model/Stats.hpp" #include #include @@ -36,5 +37,7 @@ class MainWindow : public sf::RenderWindow{ void drawGameOver(int gridX, int griY); - void drawATH(); + void drawATH(Stats stats); + + void drawGame(std::vector > grid, bool gameIsOver, Stats stats); }; -- cgit v1.2.3