Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. //
  2. // Created by sotiris on 4/25/2017.
  3. //
  4.  
  5. #ifndef GHOST_PLAYERMANUALY_H
  6. #define GHOST_PLAYERMANUALY_H
  7. #include "Player/Player.h"
  8. #include "Interfaces/MoveAble.h"
  9. #include "Move.h"
  10. #include <windows.h>
  11. #include "stdio.h"
  12.  
  13. class playerManualy:public Player,public MoveAble {
  14. playerManualy():Player(){
  15. std::string name="Sotiris";
  16. std::string id="161075";
  17. };
  18. int getMove(char maze[5][5])override{
  19. HANDLE handle=GetStdHandle(STD_INPUT_HANDLE);
  20. SetConsoleMode(handle,ENABLE_PROCESSED_INPUT);
  21. CHAR buffer[10];
  22. DWORD nChars;
  23. ReadConsole(handle,buffer,10,&nChars,NULL);
  24. int input=atoi(buffer);
  25. switch(input) {
  26. case 8 :
  27. return UP;
  28. case 2:
  29. return DOWN;
  30. case 4:
  31. return LEFT;
  32. case 6:
  33. return RIGHT;
  34. case 1:
  35. return STAND;
  36. case 3:
  37. return TELEPORT;
  38. }
  39. return STAND;
  40. };
  41. };
  42.  
  43.  
  44. #endif //GHOST_PLAYERMANUALY_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement