summaryrefslogtreecommitdiff
path: root/scene/2d/screen_button.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/2d/screen_button.cpp')
-rw-r--r--scene/2d/screen_button.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/scene/2d/screen_button.cpp b/scene/2d/screen_button.cpp
index 32a5323419..b606634819 100644
--- a/scene/2d/screen_button.cpp
+++ b/scene/2d/screen_button.cpp
@@ -92,7 +92,10 @@ void TouchScreenButton::_notification(int p_what) {
if (!get_scene()->is_editor_hint() && !OS::get_singleton()->has_touchscreen_ui_hint() && visibility==VISIBILITY_TOUCHSCREEN_ONLY)
return;
update();
- set_process_input(true);
+
+ if (!get_scene()->is_editor_hint())
+ set_process_input(true);
+
if (action.operator String()!="" && InputMap::get_singleton()->has_action(action)) {
action_id=InputMap::get_singleton()->get_action_id(action);
} else {
@@ -129,6 +132,9 @@ void TouchScreenButton::_input(const InputEvent& p_event) {
if (!get_scene())
return;
+ if (p_event.device != 0)
+ return;
+
if (passby_press) {
if (p_event.type==InputEvent::SCREEN_TOUCH && !p_event.screen_touch.pressed && finger_pressed==p_event.screen_touch.index) {
@@ -167,7 +173,8 @@ void TouchScreenButton::_input(const InputEvent& p_event) {
}
} else {
- touched=Rect2(Point2(),texture->get_size()).has_point(coord);
+ if (texture.is_valid())
+ touched=Rect2(Point2(),texture->get_size()).has_point(coord);
}
@@ -242,8 +249,8 @@ void TouchScreenButton::_input(const InputEvent& p_event) {
touched=true;
}
} else {
-
- touched=Rect2(Point2(),texture->get_size()).has_point(coord);
+ if (!texture.is_null())
+ touched=Rect2(Point2(),texture->get_size()).has_point(coord);
}