Vous êtes sur la page 1sur 2

#include <iostream>

#include "game.h"
using namespace std;
int main()
{
Game gameHeart ;
cout << "Calling gameHeart.run" << endl ;
gameHeart.run();
return 0;
}

#include "game.h"
#include <conio.h>
#include <iostream>
using namespace std ;
bool Game::run(void)
{
char key = 'a';
while(key != 'z')
{
while (!getInput(&key))
{
}
cout << "Here's what you pressed :" << key << endl ;
}
cout << "End of the game" << endl ;
return true ;
}
bool Game::getInput(char *c)
{
if(kbhit())
{
*c = getch();
return true ;
}
return false ;
}

#ifndef GAME_H
#define GAME_H

class Game
{
public:
bool run(void);
protected:
bool getInput (char *c);
void timerUpdate(void);
private:
};
#endif // GAME_H

Project -> Build Options -> Linker Settings -> Link Libraries -> Add -> winmm (w
ithout the .lib extension) -> OK