diff --git a/core/global_constants.cpp b/core/global_constants.cpp index 6f58af2ccf8..8bddeae69a4 100644 --- a/core/global_constants.cpp +++ b/core/global_constants.cpp @@ -86,6 +86,8 @@ static Vector<_GlobalConstant> _global_constants; VARIANT_ENUM_CAST(KeyList); VARIANT_ENUM_CAST(KeyModifierMask); +VARIANT_ENUM_CAST(ButtonList); +VARIANT_ENUM_CAST(JoystickList); void register_global_constants() { @@ -367,82 +369,82 @@ void register_global_constants() { BIND_GLOBAL_ENUM_CONSTANT(KEY_MASK_GROUP_SWITCH); // mouse - BIND_GLOBAL_CONSTANT(BUTTON_LEFT); - BIND_GLOBAL_CONSTANT(BUTTON_RIGHT); - BIND_GLOBAL_CONSTANT(BUTTON_MIDDLE); - BIND_GLOBAL_CONSTANT(BUTTON_WHEEL_UP); - BIND_GLOBAL_CONSTANT(BUTTON_WHEEL_DOWN); - BIND_GLOBAL_CONSTANT(BUTTON_WHEEL_LEFT); - BIND_GLOBAL_CONSTANT(BUTTON_WHEEL_RIGHT); - BIND_GLOBAL_CONSTANT(BUTTON_MASK_LEFT); - BIND_GLOBAL_CONSTANT(BUTTON_MASK_RIGHT); - BIND_GLOBAL_CONSTANT(BUTTON_MASK_MIDDLE); + BIND_GLOBAL_ENUM_CONSTANT(BUTTON_LEFT); + BIND_GLOBAL_ENUM_CONSTANT(BUTTON_RIGHT); + BIND_GLOBAL_ENUM_CONSTANT(BUTTON_MIDDLE); + BIND_GLOBAL_ENUM_CONSTANT(BUTTON_WHEEL_UP); + BIND_GLOBAL_ENUM_CONSTANT(BUTTON_WHEEL_DOWN); + BIND_GLOBAL_ENUM_CONSTANT(BUTTON_WHEEL_LEFT); + BIND_GLOBAL_ENUM_CONSTANT(BUTTON_WHEEL_RIGHT); + BIND_GLOBAL_ENUM_CONSTANT(BUTTON_MASK_LEFT); + BIND_GLOBAL_ENUM_CONSTANT(BUTTON_MASK_RIGHT); + BIND_GLOBAL_ENUM_CONSTANT(BUTTON_MASK_MIDDLE); //joypads - BIND_GLOBAL_CONSTANT(JOY_BUTTON_0); - BIND_GLOBAL_CONSTANT(JOY_BUTTON_1); - BIND_GLOBAL_CONSTANT(JOY_BUTTON_2); - BIND_GLOBAL_CONSTANT(JOY_BUTTON_3); - BIND_GLOBAL_CONSTANT(JOY_BUTTON_4); - BIND_GLOBAL_CONSTANT(JOY_BUTTON_5); - BIND_GLOBAL_CONSTANT(JOY_BUTTON_6); - BIND_GLOBAL_CONSTANT(JOY_BUTTON_7); - BIND_GLOBAL_CONSTANT(JOY_BUTTON_8); - BIND_GLOBAL_CONSTANT(JOY_BUTTON_9); - BIND_GLOBAL_CONSTANT(JOY_BUTTON_10); - BIND_GLOBAL_CONSTANT(JOY_BUTTON_11); - BIND_GLOBAL_CONSTANT(JOY_BUTTON_12); - BIND_GLOBAL_CONSTANT(JOY_BUTTON_13); - BIND_GLOBAL_CONSTANT(JOY_BUTTON_14); - BIND_GLOBAL_CONSTANT(JOY_BUTTON_15); - BIND_GLOBAL_CONSTANT(JOY_BUTTON_MAX); + BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_0); + BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_1); + BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_2); + BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_3); + BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_4); + BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_5); + BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_6); + BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_7); + BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_8); + BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_9); + BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_10); + BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_11); + BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_12); + BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_13); + BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_14); + BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_15); + BIND_GLOBAL_ENUM_CONSTANT(JOY_BUTTON_MAX); - BIND_GLOBAL_CONSTANT(JOY_SONY_CIRCLE); - BIND_GLOBAL_CONSTANT(JOY_SONY_X); - BIND_GLOBAL_CONSTANT(JOY_SONY_SQUARE); - BIND_GLOBAL_CONSTANT(JOY_SONY_TRIANGLE); + BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_CIRCLE); + BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_X); + BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_SQUARE); + BIND_GLOBAL_ENUM_CONSTANT(JOY_SONY_TRIANGLE); - BIND_GLOBAL_CONSTANT(JOY_XBOX_B); - BIND_GLOBAL_CONSTANT(JOY_XBOX_A); - BIND_GLOBAL_CONSTANT(JOY_XBOX_X); - BIND_GLOBAL_CONSTANT(JOY_XBOX_Y); + BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_B); + BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_A); + BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_X); + BIND_GLOBAL_ENUM_CONSTANT(JOY_XBOX_Y); - BIND_GLOBAL_CONSTANT(JOY_DS_A); - BIND_GLOBAL_CONSTANT(JOY_DS_B); - BIND_GLOBAL_CONSTANT(JOY_DS_X); - BIND_GLOBAL_CONSTANT(JOY_DS_Y); + BIND_GLOBAL_ENUM_CONSTANT(JOY_DS_A); + BIND_GLOBAL_ENUM_CONSTANT(JOY_DS_B); + BIND_GLOBAL_ENUM_CONSTANT(JOY_DS_X); + BIND_GLOBAL_ENUM_CONSTANT(JOY_DS_Y); - BIND_GLOBAL_CONSTANT(JOY_SELECT); - BIND_GLOBAL_CONSTANT(JOY_START); - BIND_GLOBAL_CONSTANT(JOY_DPAD_UP); - BIND_GLOBAL_CONSTANT(JOY_DPAD_DOWN); - BIND_GLOBAL_CONSTANT(JOY_DPAD_LEFT); - BIND_GLOBAL_CONSTANT(JOY_DPAD_RIGHT); - BIND_GLOBAL_CONSTANT(JOY_L); - BIND_GLOBAL_CONSTANT(JOY_L2); - BIND_GLOBAL_CONSTANT(JOY_L3); - BIND_GLOBAL_CONSTANT(JOY_R); - BIND_GLOBAL_CONSTANT(JOY_R2); - BIND_GLOBAL_CONSTANT(JOY_R3); + BIND_GLOBAL_ENUM_CONSTANT(JOY_SELECT); + BIND_GLOBAL_ENUM_CONSTANT(JOY_START); + BIND_GLOBAL_ENUM_CONSTANT(JOY_DPAD_UP); + BIND_GLOBAL_ENUM_CONSTANT(JOY_DPAD_DOWN); + BIND_GLOBAL_ENUM_CONSTANT(JOY_DPAD_LEFT); + BIND_GLOBAL_ENUM_CONSTANT(JOY_DPAD_RIGHT); + BIND_GLOBAL_ENUM_CONSTANT(JOY_L); + BIND_GLOBAL_ENUM_CONSTANT(JOY_L2); + BIND_GLOBAL_ENUM_CONSTANT(JOY_L3); + BIND_GLOBAL_ENUM_CONSTANT(JOY_R); + BIND_GLOBAL_ENUM_CONSTANT(JOY_R2); + BIND_GLOBAL_ENUM_CONSTANT(JOY_R3); - BIND_GLOBAL_CONSTANT(JOY_AXIS_0); - BIND_GLOBAL_CONSTANT(JOY_AXIS_1); - BIND_GLOBAL_CONSTANT(JOY_AXIS_2); - BIND_GLOBAL_CONSTANT(JOY_AXIS_3); - BIND_GLOBAL_CONSTANT(JOY_AXIS_4); - BIND_GLOBAL_CONSTANT(JOY_AXIS_5); - BIND_GLOBAL_CONSTANT(JOY_AXIS_6); - BIND_GLOBAL_CONSTANT(JOY_AXIS_7); - BIND_GLOBAL_CONSTANT(JOY_AXIS_MAX); + BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_0); + BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_1); + BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_2); + BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_3); + BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_4); + BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_5); + BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_6); + BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_7); + BIND_GLOBAL_ENUM_CONSTANT(JOY_AXIS_MAX); - BIND_GLOBAL_CONSTANT(JOY_ANALOG_LX); - BIND_GLOBAL_CONSTANT(JOY_ANALOG_LY); + BIND_GLOBAL_ENUM_CONSTANT(JOY_ANALOG_LX); + BIND_GLOBAL_ENUM_CONSTANT(JOY_ANALOG_LY); - BIND_GLOBAL_CONSTANT(JOY_ANALOG_RX); - BIND_GLOBAL_CONSTANT(JOY_ANALOG_RY); + BIND_GLOBAL_ENUM_CONSTANT(JOY_ANALOG_RX); + BIND_GLOBAL_ENUM_CONSTANT(JOY_ANALOG_RY); - BIND_GLOBAL_CONSTANT(JOY_ANALOG_L2); - BIND_GLOBAL_CONSTANT(JOY_ANALOG_R2); + BIND_GLOBAL_ENUM_CONSTANT(JOY_ANALOG_L2); + BIND_GLOBAL_ENUM_CONSTANT(JOY_ANALOG_R2); // error list diff --git a/core/os/input_event.h b/core/os/input_event.h index 5dc0f91d5f5..f2c8cc802d9 100644 --- a/core/os/input_event.h +++ b/core/os/input_event.h @@ -44,7 +44,7 @@ * The events are pretty obvious. */ -enum { +enum ButtonList { BUTTON_LEFT = 1, BUTTON_RIGHT = 2, BUTTON_MIDDLE = 3, @@ -58,7 +58,7 @@ enum { }; -enum { +enum JoystickList { JOY_BUTTON_0 = 0, JOY_BUTTON_1 = 1,