Fix space
This commit is contained in:
parent
e13d24b6c8
commit
80c37e438e
3 changed files with 35 additions and 36 deletions
|
@ -2,47 +2,45 @@
|
|||
|
||||
ConsoleController::ConsoleController()
|
||||
{
|
||||
m_game = new Game();
|
||||
m_game = new Game();
|
||||
}
|
||||
|
||||
ConsoleController::~ConsoleController()
|
||||
{
|
||||
delete m_game;
|
||||
delete m_game;
|
||||
}
|
||||
|
||||
void ConsoleController::play()
|
||||
{
|
||||
while (!m_game->isOver())
|
||||
{
|
||||
m_game->showGrid();
|
||||
char moveChoice = ' ';
|
||||
while (!m_game->isOver())
|
||||
{
|
||||
m_game->showGrid();
|
||||
char moveChoice = ' ';
|
||||
|
||||
std::cin >> moveChoice;
|
||||
std::cin >> moveChoice;
|
||||
|
||||
switch (moveChoice)
|
||||
{
|
||||
case 'z':
|
||||
std::cout << "up" << std::endl;
|
||||
break;
|
||||
switch (moveChoice)
|
||||
{
|
||||
case 'z':
|
||||
std::cout << "up" << std::endl;
|
||||
break;
|
||||
|
||||
case 's':
|
||||
std::cout << "down" << std::endl;
|
||||
break;
|
||||
case 's':
|
||||
std::cout << "down" << std::endl;
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
std::cout << "left" << std::endl;
|
||||
break;
|
||||
case 'q':
|
||||
std::cout << "left" << std::endl;
|
||||
break;
|
||||
case 'd':
|
||||
std::cout << "right" << std::endl;
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
std::cout << "right" << std::endl;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
std::cout << std::endl;
|
||||
|
||||
m_game->pop();
|
||||
}
|
||||
std::cout << std::endl;
|
||||
m_game->pop();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,19 +8,18 @@
|
|||
* Date : 29/04/2915 */
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "../../Model/Game.hpp"
|
||||
|
||||
class ConsoleController
|
||||
{
|
||||
private:
|
||||
Game * m_game;
|
||||
private:
|
||||
|
||||
public:
|
||||
ConsoleController();
|
||||
~ConsoleController();
|
||||
Game * m_game;
|
||||
|
||||
void play();
|
||||
public:
|
||||
ConsoleController();
|
||||
~ConsoleController();
|
||||
void play();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -21,8 +21,10 @@ int main()
|
|||
//Init console controller
|
||||
ConsoleController * controller = new ConsoleController();
|
||||
|
||||
//Launch game
|
||||
controller->play();
|
||||
|
||||
//Remove controlelr
|
||||
delete controller;
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue