Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 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. printf("User types%s:",buffer);
  25. getchar();
  26. int input=atoi(buffer);
  27. switch(input) {
  28. case 8 :
  29. return UP;
  30. case 2:
  31. return DOWN;
  32. case 4:
  33. return LEFT;
  34. case 6:
  35. return RIGHT;
  36. case 1:
  37. return STAND;
  38. case 3:
  39. return TELEPORT;
  40. }
  41. return STAND;
  42. };
  43. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement