From 6b305938b381fd3d779e561c9338355d60bd9b68 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Mon, 4 May 2015 17:02:53 +0200 Subject: [PATCH] Repair corrupt console controller --- .../ConsoleController/ConsoleController.cpp | 14 +++++++------- .../ConsoleController/ConsoleController.hpp | 2 +- src/main.cpp | 5 +++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Controllers/ConsoleController/ConsoleController.cpp b/src/Controllers/ConsoleController/ConsoleController.cpp index 57f626f..bcad873 100644 --- a/src/Controllers/ConsoleController/ConsoleController.cpp +++ b/src/Controllers/ConsoleController/ConsoleController.cpp @@ -1,7 +1,7 @@ #include "./ConsoleController.hpp" #include #include "../../Helpers/Keyboard.hpp" - +#include "../../Model/Stats.hpp" //==================== Constructor and Destructor ==================== @@ -31,7 +31,7 @@ void ConsoleController::run() m_game.popRandomNumber(); //First cout stats - this->coutStats(); + this->coutStats(m_game.getStats()); //First cout grid m_game.coutGrid(); @@ -47,7 +47,7 @@ void ConsoleController::run() bool moveDone=m_game.swipe(keyPress); //Cout stats - this->coutStats(); + this->coutStats(m_game.getStats()); //Cout grid m_game.coutGrid(); @@ -55,7 +55,7 @@ void ConsoleController::run() } //Last cout stats - this->coutStats(); + this->coutStats(m_game.getStats()); //Last cout grid m_game.coutGrid(); @@ -122,8 +122,8 @@ kbdh::Direction ConsoleController::waitArrowKeyPress() //Cout the stats of the game -void ConsoleController::coutStats(){ +void ConsoleController::coutStats(Stats stats){ - std::cout << std::endl << "Score : " << m_game.getScore() << std::endl; - std::cout << "Nombre de coups : " << m_game.getNbMove() << std::endl; + std::cout << std::endl << "Score : " << stats.getScore() << std::endl; + std::cout << "Nombre de coups : " << stats.getNbMove() << std::endl; } diff --git a/src/Controllers/ConsoleController/ConsoleController.hpp b/src/Controllers/ConsoleController/ConsoleController.hpp index f3e9952..67a8483 100644 --- a/src/Controllers/ConsoleController/ConsoleController.hpp +++ b/src/Controllers/ConsoleController/ConsoleController.hpp @@ -24,7 +24,7 @@ class ConsoleController //Helpers void run(); - void coutStats(); + void coutStats(Stats stats); }; #endif diff --git a/src/main.cpp b/src/main.cpp index 70f3a6b..45c029c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -7,6 +7,7 @@ //----- Personnal include ----- #include "./Controllers/SFMLController/SFMLController.hpp" +#include "./Controllers/ConsoleController/ConsoleController.hpp" //----------------------------- @@ -20,8 +21,8 @@ int main() srand(time(NULL)); //Init controller - SFMLController controller; - + //SFMLController controller; + ConsoleController controller; //Run the game controller.run();