Introduction to Keyboard Reading |
The Keyboard Queue |
Every time a key is pressed in a TNT Basic program, it is recorded and added to a queue that your program can read. The keys are recorded as raw keys, which are a way of storing the scancode, character code and modifier keys for the key press in one integer variable. Working with Raw Keys |
The raw key code isn't much good to us directly, if we want to use it we need to extract information such as the scancode, character code or modifier keys from it. To do this, we use the Raw Key Scancode, Raw Key Char and Raw Key Modifier commands. The String Editor |
The string editor provides a means of inputting and editing strings using the keyboard. It is similar in concept to a text box in a Mac OS dialog, such as the Mac OS X login window where you can type your name. You can use the string editor to have the user enter information, such as high score entries. Summary |
Every key typed into a TNT Basic program is added to a key queue that can be read using Keyboard Raw Key. You can input the raw keys into the String Editor as a way of editing text. To tell if a particular key is currently held you can use the Pressed command which takes a key scancode. The key scancodes are the same on all keyboards, but the character they represent can change from country to country. |
Table of contents |