From bf5ec3cfe56585806981815826a21bd14e9ee7d6 Mon Sep 17 00:00:00 2001 From: manzerbredes Date: Sun, 3 May 2015 10:07:39 +0200 Subject: [PATCH] Add fixed white space --- .../ConsoleController/ConsoleController.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Controllers/ConsoleController/ConsoleController.cpp b/src/Controllers/ConsoleController/ConsoleController.cpp index 1bc9b84..57f626f 100644 --- a/src/Controllers/ConsoleController/ConsoleController.cpp +++ b/src/Controllers/ConsoleController/ConsoleController.cpp @@ -70,6 +70,9 @@ kbdh::Direction ConsoleController::waitArrowKeyPress() //Initialise keyPress kbdh::Direction keyPress; + //White space to remove arrows print by the terminal + std::string spaces=" "; + //Wait for keypress while(1){ if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left)) @@ -78,7 +81,7 @@ kbdh::Direction ConsoleController::waitArrowKeyPress() while(sf::Keyboard::isKeyPressed(sf::Keyboard::Left)) { //Wait for release and try to remove arrow printed characters - std::cout << "\r" << " "; + std::cout << "\r" << spaces; } break; } @@ -88,7 +91,7 @@ kbdh::Direction ConsoleController::waitArrowKeyPress() while(sf::Keyboard::isKeyPressed(sf::Keyboard::Right)) { //Wait for release and try to remove arrow printed characters - std::cout << "\r" << " "; + std::cout << "\r" << spaces; } break; } @@ -98,7 +101,7 @@ kbdh::Direction ConsoleController::waitArrowKeyPress() while(sf::Keyboard::isKeyPressed(sf::Keyboard::Up)) { //Wait for release and try to remove arrow printed characters - std::cout << "\r" << " "; + std::cout << "\r" << spaces; } break; } @@ -108,7 +111,7 @@ kbdh::Direction ConsoleController::waitArrowKeyPress() while(sf::Keyboard::isKeyPressed(sf::Keyboard::Down)) { //Wait for release and try to remove arrow printed characters - std::cout << "\r" << " "; + std::cout << "\r" << spaces; } break; }