Allows to map an action to all devices.

This is accomplished by setting a special value (-1) to the device variable
in the InputEvent that's being used to compare with the one received from the OS.

This special value is invalid for a regular input, so it should be safe.
Implements #17942
This commit is contained in:
Nibodhika
2018-04-03 22:29:07 +00:00
parent bcf5b748b5
commit 1e28f63bcf
4 changed files with 47 additions and 19 deletions

View File

@@ -39,6 +39,11 @@ class InputMap : public Object {
GDCLASS(InputMap, Object);
public:
/**
* A special value used to signify that a given Action can be triggered by any device
*/
static int ALL_DEVICES;
struct Action {
int id;
List<Ref<InputEvent> > inputs;