Introduce DEVICE_ID_ANY, update operator == for KeyDef to match

This commit is contained in:
Jonas Höglund committed 2015-08-29 21:52:53 +02:00
1 parent a57a838c93
commit 5f2f9160f8
2 files changed
+3 -1

No files matched your search

+1
View File
@@ -4,6 +4,7 @@
const char *GetDeviceName(int deviceId) {
switch (deviceId) {
case DEVICE_ID_ANY: return "any";
case DEVICE_ID_DEFAULT: return "built-in";
case DEVICE_ID_KEYBOARD: return "kbd";
case DEVICE_ID_PAD_0: return "pad1";
+2 -1
View File
@@ -19,6 +19,7 @@
// Default device IDs
enum {
DEVICE_ID_ANY = -1, // Represents any device ID
DEVICE_ID_DEFAULT = 0, // Old Android
DEVICE_ID_KEYBOARD = 1, // PC keyboard, android keyboards
DEVICE_ID_MOUSE = 2, // PC mouse only (not touchscreen!)
@@ -94,7 +95,7 @@ public:
return false;
}
bool operator == (const KeyDef &other) const {
if (deviceId != other.deviceId) return false;
if (deviceId != other.deviceId && deviceId != DEVICE_ID_ANY && other.deviceId != DEVICE_ID_ANY) return false;
if (keyCode != other.keyCode) return false;
return true;
}