Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. /**
  2. * Function used to retrieve user keyboard input.
  3. * @return -1 if we don't use that specific key, so we can ignore it.
  4. * ASCII value if simple key is pressed or 255+ASCII value if
  5. * extended key captured.
  6. */
  7. int get_keypress() {
  8. int x, y;
  9. x = getch();
  10. switch(x) {
  11. // check if we've captured an extended key
  12. case 224: {
  13. y = getch();
  14. return 255+y;
  15. } break;
  16. default: return x;
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement