Mouse And Keyboard Actions Library

Mouse And Keyboard Actions

The Mouse and Keyboard action library is where you can find the actions required to poll and process input from the keyboard or mouse devices. The available actions are all listed below:

Check Mouse Button If Mouse Pressed
Detect Mouse Down If Mouse Down
Detect Mouse Release If Mouse Released
Check Keyboard If Keyboard Pressed
Detect Key Down If Keyboard Down
Detect Key Release If Keyboard Released

The other three actions here refer to the virtual keyboard. If you require text or numeric input in your game on a touchscreen device, then you can use the virtual keyboard actions provided to use the device OS keyboard. These actions will call up or hide the OS keyboard and accept input from it just the same as a physical keyboard, so the regular GameMaker Studio 2 keyboard actions should all work with virtual keyboards (for example, the "If Key Released" action), and any input from the virtual keyboard will be stored in the different keyboard variables, like keyboard_string, or keyboard_last_char, etc...).

Opening or closing the virtual keyboard will generate System Asynchronous Events, in which the async_load DS map will be populated with the following key/value pairs:

The available virtual keyboard actions are:

Show Virtual Keyboard Show Virtual Keyboard
Hide Virtual Keyboard Hide Virtual Keyboard
Get Virtual Keyboard Height Get Virtual Keyboard Height
If Virtual Keyboard Is Showing If Virtual Keyboard Is Showing