Repair corrupt console controller

This commit is contained in:
manzerbredes 2015-05-04 17:02:53 +02:00
parent a1c9b58c29
commit 6b305938b3
3 changed files with 11 additions and 10 deletions

View file

@ -1,7 +1,7 @@
#include "./ConsoleController.hpp" #include "./ConsoleController.hpp"
#include <SFML/Window/Keyboard.hpp> #include <SFML/Window/Keyboard.hpp>
#include "../../Helpers/Keyboard.hpp" #include "../../Helpers/Keyboard.hpp"
#include "../../Model/Stats.hpp"
//==================== Constructor and Destructor ==================== //==================== Constructor and Destructor ====================
@ -31,7 +31,7 @@ void ConsoleController::run()
m_game.popRandomNumber(); m_game.popRandomNumber();
//First cout stats //First cout stats
this->coutStats(); this->coutStats(m_game.getStats());
//First cout grid //First cout grid
m_game.coutGrid(); m_game.coutGrid();
@ -47,7 +47,7 @@ void ConsoleController::run()
bool moveDone=m_game.swipe(keyPress); bool moveDone=m_game.swipe(keyPress);
//Cout stats //Cout stats
this->coutStats(); this->coutStats(m_game.getStats());
//Cout grid //Cout grid
m_game.coutGrid(); m_game.coutGrid();
@ -55,7 +55,7 @@ void ConsoleController::run()
} }
//Last cout stats //Last cout stats
this->coutStats(); this->coutStats(m_game.getStats());
//Last cout grid //Last cout grid
m_game.coutGrid(); m_game.coutGrid();
@ -122,8 +122,8 @@ kbdh::Direction ConsoleController::waitArrowKeyPress()
//Cout the stats of the game //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 << std::endl << "Score : " << stats.getScore() << std::endl;
std::cout << "Nombre de coups : " << m_game.getNbMove() << std::endl; std::cout << "Nombre de coups : " << stats.getNbMove() << std::endl;
} }

View file

@ -24,7 +24,7 @@ class ConsoleController
//Helpers //Helpers
void run(); void run();
void coutStats(); void coutStats(Stats stats);
}; };
#endif #endif

View file

@ -7,6 +7,7 @@
//----- Personnal include ----- //----- Personnal include -----
#include "./Controllers/SFMLController/SFMLController.hpp" #include "./Controllers/SFMLController/SFMLController.hpp"
#include "./Controllers/ConsoleController/ConsoleController.hpp"
//----------------------------- //-----------------------------
@ -20,8 +21,8 @@ int main()
srand(time(NULL)); srand(time(NULL));
//Init controller //Init controller
SFMLController controller; //SFMLController controller;
ConsoleController controller;
//Run the game //Run the game
controller.run(); controller.run();