Key state

Returns state of a keyboard key.

Parameters

A1 [in,1u]
Device: keyboard - 2
A2 [in,1u]
Message type - 2
AY [in,4i]
Key - it can be:
A3 [out,1b]
Whether the key is down
A4 [out,1b]
Whether the key is toggled

Description

This message allows to check the state of a particular keyboard key. Toggle state can be useful to check the state of a key like [CapsLock].

Received state can become from the time e.g. when last input message was generated. So if you want to check the state of a key in every frame of a real-time program, you should use asynch key state output message instead.