Fix InputEvent device id clash

`InputMap::ALL_DEVICES` and `InputEvent::DEVICE_ID_EMULATION` have the
same value `-1`.

Change value of `InputMap::All_DEVICES` so that it's different from
`InputEvent::DEVICE_ID_EMULATION`. `InputEvent::DEVICE_ID_EMULATION`
is part of the API and can't be changed without potentially breaking
projects.

Gather all special device constants in a single location inside
`InputEvent`.

Add a converter to project settings, that takes care of adjusting
project files during loading.
This commit is contained in:
Markus Sauermann
2024-10-01 20:56:06 +02:00
parent f4af8201ba
commit 916d480686
7 changed files with 30 additions and 21 deletions

View File

@@ -62,8 +62,9 @@ protected:
static void _bind_methods();
public:
static const int DEVICE_ID_EMULATION;
static const int DEVICE_ID_INTERNAL;
inline static constexpr int DEVICE_ID_EMULATION = -1;
inline static constexpr int DEVICE_ID_INTERNAL = -2;
inline static constexpr int DEVICE_ID_ALL_DEVICES = -3; // Signify that a given Action can be triggered by any device.
void set_device(int p_device);
int get_device() const;