diff options
| author | manzerbredes <loic.guegan_secondary@yahoo.fr> | 2015-05-03 09:57:31 +0200 |
|---|---|---|
| committer | manzerbredes <loic.guegan_secondary@yahoo.fr> | 2015-05-03 09:57:31 +0200 |
| commit | 4cc6c6596b614fce392040b85a182dbf50d0b044 (patch) | |
| tree | ec6932c060e8a9ebc54be380832db47fb2c6c735 /src/Controllers/ConsoleController/ConsoleController.cpp | |
| parent | af7f2fc8700df64f245caf7b864e777831867c3f (diff) | |
Organize all the code
Diffstat (limited to 'src/Controllers/ConsoleController/ConsoleController.cpp')
| -rw-r--r-- | src/Controllers/ConsoleController/ConsoleController.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/Controllers/ConsoleController/ConsoleController.cpp b/src/Controllers/ConsoleController/ConsoleController.cpp index 66dc370..1bc9b84 100644 --- a/src/Controllers/ConsoleController/ConsoleController.cpp +++ b/src/Controllers/ConsoleController/ConsoleController.cpp @@ -2,14 +2,22 @@ #include <SFML/Window/Keyboard.hpp> #include "../../Helpers/Keyboard.hpp" + +//==================== Constructor and Destructor ==================== + +//Constructor ConsoleController::ConsoleController() { } +//Destructor ConsoleController::~ConsoleController() { } +//==================== Helpers ==================== + +//Run the game. void ConsoleController::run() { @@ -22,7 +30,7 @@ void ConsoleController::run() //Pop a random number on the grid m_game.popRandomNumber(); - + //First cout stats this->coutStats(); //First cout grid @@ -38,21 +46,25 @@ void ConsoleController::run() //Apply move bool moveDone=m_game.swipe(keyPress); - - + //Cout stats this->coutStats(); //Cout grid m_game.coutGrid(); } - + + //Last cout stats this->coutStats(); + + //Last cout grid m_game.coutGrid(); } + +//Wait for keypress and return the keyPress. kbdh::Direction ConsoleController::waitArrowKeyPress() { //Initialise keyPress @@ -92,7 +104,6 @@ kbdh::Direction ConsoleController::waitArrowKeyPress() } if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down)) { - // la touche "flèche gauche" est enfoncée : on bouge le personnage keyPress=kbdh::Down; while(sf::Keyboard::isKeyPressed(sf::Keyboard::Down)) { @@ -107,12 +118,7 @@ kbdh::Direction ConsoleController::waitArrowKeyPress() } -void ConsoleController::clearScreen(){ - for(int i;i<100;i++){ - std::cout << std::endl; - } -} - +//Cout the stats of the game void ConsoleController::coutStats(){ std::cout << std::endl << "Score : " << m_game.getScore() << std::endl; |
