Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char leerTecla(char &tecla,int retardo)
- {
- int ms=0;
- clock_t t1,t2;
- while (ms<retardo)
- {
- cout<<endl<<ms;
- t1=time(NULL);
- if (kbhit())
- {
- switch(getch())
- {
- case 'W':
- case 'w':
- tecla='w';
- break;
- case 'S':
- case 's':
- tecla='s';
- break;
- case 'D':
- case 'd':
- tecla='d';
- break;
- case 'A':
- case 'a':
- tecla='a';
- break;
- }
- t2=time(NULL);
- ms=ms+1000* (t2-t1)/CLOCKS_PER_SEC;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement