-
Notifications
You must be signed in to change notification settings - Fork 11
Native Input
VSM has the possibility to read raw input from a device. This is useful to intercept keyboard and mouse events without the need of a user interface (not even an opened window).
To insert this feature, add to your project an instance of KeyRunTimePlugin
.
By default, when a key is pressed, its value will be set in a variable called PressedKey
. If you want to change this variable name, use the PressedKeySceneflowVar
string property.
To wait for key presses, keep a node alive with a loop, and add a conditional edge testing whether PressedKey == <yourkey>
. For example, for key a
you will test PressedKey == "A"
. This is a low-level interface, thus no distinction is made between A
and a
: pressing the shift key will trigger itself an event.
Limitations:
- The variable
Pressedkey
is not reset when a key is released. If your scene flow loops back to a key pressing test, thenPressedkey=""
must be explicitely executed before (tip: useCommand Executions
). - The reference layout is for American keyboards. On German keyboards, for example,
y
andz
will be inverted. - Can not manage multiple key presses.
Future work:
- Manage mouse clicks