3. User Input
| Without knowing what the user does you won't achieve more than programming a screensaver, so this chapter covers all the possibilities to check and handle user input in ZweiDe. | |
3.1 Mouse / CursorBasically, there are three values provided by ZweiDe: Mouse position, wheel- and key-state. There are several commands to check each:ZweiDe.GetMousePos(out x, out y); wheel = ZweiDe.GetMouseWheel(); pressedLeft = ZweiDe.MouseDown(ZweiDe.MouseID.Left); clickedLeft = ZweiDe.MouseHit(ZweiDe.MouseID.Left); clickedLeft = ZweiDe.MouseHitFrame(ZweiDe.MouseID.Left);MouseHit returns how often the mouse key has been clicked since it was called the last time while MouseHitFrame only returns whether or not it was been clicked since the last call of UpdateKeys. Of course, you can also re-set these values using SetMousePos, SetMouseWheel and OverrideMouseHit. |
|
3.2 KeyboardRetrieving key states is all input you can get from the keyboard. Though, they are available in two forms. The first one ressembles recieving key states from the mouse input:pressedSpace = ZweiDe.KeyDown(ZweiDe.KeyID.Space); clickedSpace = ZweiDe.KeyHit(ZweiDe.KeyID.Space); clickedSpace = ZweiDe.KeyHitFrame(ZweiDe.KeyID.Space);And of course, there's also a OverrideKeyHit method. The second form retrieving key states is directly retrieving character codes.
newChar = ZweiDe.GetInputChar();
returns null if no key has pressed or a char value for the last recieved character. This method is inteded for text input usage as
function keys like "shift" are already taken into account; you are directly getting the character code typed by the user. You can also simulate
user input by using OverrideInputChar.
|
|
|
|