diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/core_constants.cpp | 30 | ||||
-rw-r--r-- | core/input/input.cpp | 10 | ||||
-rw-r--r-- | core/input/input_event.cpp | 56 | ||||
-rw-r--r-- | core/input/input_event.h | 30 |
4 files changed, 63 insertions, 63 deletions
diff --git a/core/core_constants.cpp b/core/core_constants.cpp index 5abfee05bf..4f2faf4172 100644 --- a/core/core_constants.cpp +++ b/core/core_constants.cpp @@ -106,7 +106,7 @@ static Vector<_CoreConstant> _global_constants; VARIANT_ENUM_CAST(KeyList); VARIANT_ENUM_CAST(KeyModifierMask); -VARIANT_ENUM_CAST(ButtonList); +VARIANT_ENUM_CAST(MouseButton); VARIANT_ENUM_CAST(JoyButtonList); VARIANT_ENUM_CAST(JoyAxisList); VARIANT_ENUM_CAST(MidiMessageList); @@ -397,20 +397,20 @@ void register_global_constants() { BIND_CORE_ENUM_CONSTANT(KEY_MASK_GROUP_SWITCH); // mouse - BIND_CORE_ENUM_CONSTANT(BUTTON_LEFT); - BIND_CORE_ENUM_CONSTANT(BUTTON_RIGHT); - BIND_CORE_ENUM_CONSTANT(BUTTON_MIDDLE); - BIND_CORE_ENUM_CONSTANT(BUTTON_XBUTTON1); - BIND_CORE_ENUM_CONSTANT(BUTTON_XBUTTON2); - BIND_CORE_ENUM_CONSTANT(BUTTON_WHEEL_UP); - BIND_CORE_ENUM_CONSTANT(BUTTON_WHEEL_DOWN); - BIND_CORE_ENUM_CONSTANT(BUTTON_WHEEL_LEFT); - BIND_CORE_ENUM_CONSTANT(BUTTON_WHEEL_RIGHT); - BIND_CORE_ENUM_CONSTANT(BUTTON_MASK_LEFT); - BIND_CORE_ENUM_CONSTANT(BUTTON_MASK_RIGHT); - BIND_CORE_ENUM_CONSTANT(BUTTON_MASK_MIDDLE); - BIND_CORE_ENUM_CONSTANT(BUTTON_MASK_XBUTTON1); - BIND_CORE_ENUM_CONSTANT(BUTTON_MASK_XBUTTON2); + BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_LEFT); + BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_RIGHT); + BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_MIDDLE); + BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_XBUTTON1); + BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_XBUTTON2); + BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_WHEEL_UP); + BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_WHEEL_DOWN); + BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_WHEEL_LEFT); + BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_WHEEL_RIGHT); + BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_MASK_LEFT); + BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_MASK_RIGHT); + BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_MASK_MIDDLE); + BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_MASK_XBUTTON1); + BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_MASK_XBUTTON2); // Joypad buttons BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_INVALID); diff --git a/core/input/input.cpp b/core/input/input.cpp index 3a8c1c1628..09a5c5ef32 100644 --- a/core/input/input.cpp +++ b/core/input/input.cpp @@ -560,11 +560,11 @@ void Input::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_em button_event->set_position(st->get_position()); button_event->set_global_position(st->get_position()); button_event->set_pressed(st->is_pressed()); - button_event->set_button_index(BUTTON_LEFT); + button_event->set_button_index(MOUSE_BUTTON_LEFT); if (st->is_pressed()) { - button_event->set_button_mask(mouse_button_mask | (1 << (BUTTON_LEFT - 1))); + button_event->set_button_mask(mouse_button_mask | (1 << (MOUSE_BUTTON_LEFT - 1))); } else { - button_event->set_button_mask(mouse_button_mask & ~(1 << (BUTTON_LEFT - 1))); + button_event->set_button_mask(mouse_button_mask & ~(1 << (MOUSE_BUTTON_LEFT - 1))); } _parse_input_event_impl(button_event, true); @@ -792,8 +792,8 @@ void Input::ensure_touch_mouse_raised() { button_event->set_position(mouse_pos); button_event->set_global_position(mouse_pos); button_event->set_pressed(false); - button_event->set_button_index(BUTTON_LEFT); - button_event->set_button_mask(mouse_button_mask & ~(1 << (BUTTON_LEFT - 1))); + button_event->set_button_index(MOUSE_BUTTON_LEFT); + button_event->set_button_mask(mouse_button_mask & ~(1 << (MOUSE_BUTTON_LEFT - 1))); _parse_input_event_impl(button_event, true); } diff --git a/core/input/input_event.cpp b/core/input/input_event.cpp index c6910d2b1f..99cc51b95e 100644 --- a/core/input/input_event.cpp +++ b/core/input/input_event.cpp @@ -619,15 +619,15 @@ String InputEventMouseButton::as_text() const { // Button int idx = get_button_index(); switch (idx) { - case BUTTON_LEFT: - case BUTTON_RIGHT: - case BUTTON_MIDDLE: - case BUTTON_WHEEL_UP: - case BUTTON_WHEEL_DOWN: - case BUTTON_WHEEL_LEFT: - case BUTTON_WHEEL_RIGHT: - case BUTTON_XBUTTON1: - case BUTTON_XBUTTON2: + case MOUSE_BUTTON_LEFT: + case MOUSE_BUTTON_RIGHT: + case MOUSE_BUTTON_MIDDLE: + case MOUSE_BUTTON_WHEEL_UP: + case MOUSE_BUTTON_WHEEL_DOWN: + case MOUSE_BUTTON_WHEEL_LEFT: + case MOUSE_BUTTON_WHEEL_RIGHT: + case MOUSE_BUTTON_XBUTTON1: + case MOUSE_BUTTON_XBUTTON2: full_string += RTR(_mouse_button_descriptions[idx - 1]); // button index starts from 1, array index starts from 0, so subtract 1 break; default: @@ -651,15 +651,15 @@ String InputEventMouseButton::to_string() { String button_string = itos(idx); switch (idx) { - case BUTTON_LEFT: - case BUTTON_RIGHT: - case BUTTON_MIDDLE: - case BUTTON_WHEEL_UP: - case BUTTON_WHEEL_DOWN: - case BUTTON_WHEEL_LEFT: - case BUTTON_WHEEL_RIGHT: - case BUTTON_XBUTTON1: - case BUTTON_XBUTTON2: + case MOUSE_BUTTON_LEFT: + case MOUSE_BUTTON_RIGHT: + case MOUSE_BUTTON_MIDDLE: + case MOUSE_BUTTON_WHEEL_UP: + case MOUSE_BUTTON_WHEEL_DOWN: + case MOUSE_BUTTON_WHEEL_LEFT: + case MOUSE_BUTTON_WHEEL_RIGHT: + case MOUSE_BUTTON_XBUTTON1: + case MOUSE_BUTTON_XBUTTON2: button_string += " (" + RTR(_mouse_button_descriptions[idx - 1]) + ")"; // button index starts from 1, array index starts from 0, so subtract 1 break; default: @@ -761,20 +761,20 @@ String InputEventMouseMotion::to_string() { int button_mask = get_button_mask(); String button_mask_string = itos(button_mask); switch (get_button_mask()) { - case BUTTON_MASK_LEFT: - button_mask_string += " (" + RTR(_mouse_button_descriptions[BUTTON_LEFT - 1]) + ")"; + case MOUSE_BUTTON_MASK_LEFT: + button_mask_string += " (" + RTR(_mouse_button_descriptions[MOUSE_BUTTON_LEFT - 1]) + ")"; break; - case BUTTON_MASK_MIDDLE: - button_mask_string += " (" + RTR(_mouse_button_descriptions[BUTTON_MIDDLE - 1]) + ")"; + case MOUSE_BUTTON_MASK_MIDDLE: + button_mask_string += " (" + RTR(_mouse_button_descriptions[MOUSE_BUTTON_MIDDLE - 1]) + ")"; break; - case BUTTON_MASK_RIGHT: - button_mask_string += " (" + RTR(_mouse_button_descriptions[BUTTON_RIGHT - 1]) + ")"; + case MOUSE_BUTTON_MASK_RIGHT: + button_mask_string += " (" + RTR(_mouse_button_descriptions[MOUSE_BUTTON_RIGHT - 1]) + ")"; break; - case BUTTON_MASK_XBUTTON1: - button_mask_string += " (" + RTR(_mouse_button_descriptions[BUTTON_XBUTTON1 - 1]) + ")"; + case MOUSE_BUTTON_MASK_XBUTTON1: + button_mask_string += " (" + RTR(_mouse_button_descriptions[MOUSE_BUTTON_XBUTTON1 - 1]) + ")"; break; - case BUTTON_MASK_XBUTTON2: - button_mask_string += " (" + RTR(_mouse_button_descriptions[BUTTON_XBUTTON2 - 1]) + ")"; + case MOUSE_BUTTON_MASK_XBUTTON2: + button_mask_string += " (" + RTR(_mouse_button_descriptions[MOUSE_BUTTON_XBUTTON2 - 1]) + ")"; break; default: break; diff --git a/core/input/input_event.h b/core/input/input_event.h index df81b9fc75..42bfdd340e 100644 --- a/core/input/input_event.h +++ b/core/input/input_event.h @@ -42,21 +42,21 @@ * The events are pretty obvious. */ -enum ButtonList { - BUTTON_LEFT = 1, - BUTTON_RIGHT = 2, - BUTTON_MIDDLE = 3, - BUTTON_WHEEL_UP = 4, - BUTTON_WHEEL_DOWN = 5, - BUTTON_WHEEL_LEFT = 6, - BUTTON_WHEEL_RIGHT = 7, - BUTTON_XBUTTON1 = 8, - BUTTON_XBUTTON2 = 9, - BUTTON_MASK_LEFT = (1 << (BUTTON_LEFT - 1)), - BUTTON_MASK_RIGHT = (1 << (BUTTON_RIGHT - 1)), - BUTTON_MASK_MIDDLE = (1 << (BUTTON_MIDDLE - 1)), - BUTTON_MASK_XBUTTON1 = (1 << (BUTTON_XBUTTON1 - 1)), - BUTTON_MASK_XBUTTON2 = (1 << (BUTTON_XBUTTON2 - 1)) +enum MouseButton { + MOUSE_BUTTON_LEFT = 1, + MOUSE_BUTTON_RIGHT = 2, + MOUSE_BUTTON_MIDDLE = 3, + MOUSE_BUTTON_WHEEL_UP = 4, + MOUSE_BUTTON_WHEEL_DOWN = 5, + MOUSE_BUTTON_WHEEL_LEFT = 6, + MOUSE_BUTTON_WHEEL_RIGHT = 7, + MOUSE_BUTTON_XBUTTON1 = 8, + MOUSE_BUTTON_XBUTTON2 = 9, + MOUSE_BUTTON_MASK_LEFT = (1 << (MOUSE_BUTTON_LEFT - 1)), + MOUSE_BUTTON_MASK_RIGHT = (1 << (MOUSE_BUTTON_RIGHT - 1)), + MOUSE_BUTTON_MASK_MIDDLE = (1 << (MOUSE_BUTTON_MIDDLE - 1)), + MOUSE_BUTTON_MASK_XBUTTON1 = (1 << (MOUSE_BUTTON_XBUTTON1 - 1)), + MOUSE_BUTTON_MASK_XBUTTON2 = (1 << (MOUSE_BUTTON_XBUTTON2 - 1)) }; enum JoyButtonList { |