1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-23 15:16:17 +00:00

Removal of InputEvent as built-in Variant type..

this might cause bugs I haven't found yet..
This commit is contained in:
Juan Linietsky
2017-05-20 12:38:03 -03:00
parent 93f9a83062
commit 5b3709d309
206 changed files with 9547 additions and 10167 deletions

View File

@@ -287,12 +287,12 @@ void ButtonArray::_notification(int p_what) {
}
}
void ButtonArray::_gui_input(const InputEvent &p_event) {
void ButtonArray::_gui_input(const Ref<InputEvent> &p_event) {
if (
((orientation == HORIZONTAL && p_event.is_action("ui_left")) ||
(orientation == VERTICAL && p_event.is_action("ui_up"))) &&
p_event.is_pressed() && selected > 0) {
((orientation == HORIZONTAL && p_event->is_action("ui_left")) ||
(orientation == VERTICAL && p_event->is_action("ui_up"))) &&
p_event->is_pressed() && selected > 0) {
set_selected(selected - 1);
accept_event();
emit_signal("button_selected", selected);
@@ -300,18 +300,20 @@ void ButtonArray::_gui_input(const InputEvent &p_event) {
}
if (
((orientation == HORIZONTAL && p_event.is_action("ui_right")) ||
(orientation == VERTICAL && p_event.is_action("ui_down"))) &&
p_event.is_pressed() && selected < (buttons.size() - 1)) {
((orientation == HORIZONTAL && p_event->is_action("ui_right")) ||
(orientation == VERTICAL && p_event->is_action("ui_down"))) &&
p_event->is_pressed() && selected < (buttons.size() - 1)) {
set_selected(selected + 1);
accept_event();
emit_signal("button_selected", selected);
return;
}
if (p_event.type == InputEvent::MOUSE_BUTTON && p_event.mouse_button.pressed && p_event.mouse_button.button_index == BUTTON_LEFT) {
Ref<InputEventMouseButton> mb = p_event;
int ofs = orientation == HORIZONTAL ? p_event.mouse_button.x : p_event.mouse_button.y;
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
int ofs = orientation == HORIZONTAL ? mb->get_pos().x : mb->get_pos().y;
for (int i = 0; i < buttons.size(); i++) {
@@ -324,9 +326,11 @@ void ButtonArray::_gui_input(const InputEvent &p_event) {
}
}
if (p_event.type == InputEvent::MOUSE_MOTION) {
Ref<InputEventMouseMotion> mm = p_event;
int ofs = orientation == HORIZONTAL ? p_event.mouse_motion.x : p_event.mouse_motion.y;
if (mm.is_valid()) {
int ofs = orientation == HORIZONTAL ? mm->get_pos().x : mm->get_pos().y;
int new_hover = -1;
for (int i = 0; i < buttons.size(); i++) {