In this second episode of "Let's Code: MS-DOS" we take a look at keyboard handling. To meaningfully control a player character we need to be at least able to query keypresses of the arrow keys, plus any other keys we deem worthwhile. I will talk you through the process on how you can do this using Turbo C, using builtin functions, and how to figure out which keys produce which scancodes using the kbhit() and getch() functions.
A more detailed keyboard input is possible by reading from the hardware directly, allowing you to detect even keypresses of the shift, alt and ctrl keys. But that is for another time...
Source code: gist.github.co...
Long Stroll von Kevin MacLeod ist unter der Lizenz "Creative Commons Attribution" (creativecommon...) lizenziert.
Quelle: incompetech.com...
Künstler: incompetech.com/
Негізгі бет Ғылым және технология Let's Code MS DOS 0x02: The Keyboard
Пікірлер: 27