From 01632a824ee7e2326aa90b32d75c2fe09f61a37e Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sun, 29 Jun 2014 22:41:02 -0300 Subject: Bug Fixes -=-=-=-=- -Documentation now shows overridable theme values (though this needs to be documented). -Detect when object transform is flipped and flip normals too. -TileMap can specify bounce and friction for collision. -Removed limit of 4 lights per object -Added is_hovered() to buttons. --- scene/gui/base_button.cpp | 5 +++++ scene/gui/base_button.h | 2 ++ scene/gui/control.cpp | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) (limited to 'scene/gui') diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index 2e03871063..ac2417d539 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -276,6 +276,10 @@ bool BaseButton::is_pressed() const { return toggle_mode?status.pressed:status.press_attempt; } +bool BaseButton::is_hovered() const { + + return status.hovering; +} BaseButton::DrawMode BaseButton::get_draw_mode() const { @@ -337,6 +341,7 @@ void BaseButton::_bind_methods() { ObjectTypeDB::bind_method(_MD("_input_event"),&BaseButton::_input_event); ObjectTypeDB::bind_method(_MD("set_pressed","pressed"),&BaseButton::set_pressed); ObjectTypeDB::bind_method(_MD("is_pressed"),&BaseButton::is_pressed); + ObjectTypeDB::bind_method(_MD("is_hovered"),&BaseButton::is_hovered); ObjectTypeDB::bind_method(_MD("set_toggle_mode","enabled"),&BaseButton::set_toggle_mode); ObjectTypeDB::bind_method(_MD("is_toggle_mode"),&BaseButton::is_toggle_mode); ObjectTypeDB::bind_method(_MD("set_disabled","disabled"),&BaseButton::set_disabled); diff --git a/scene/gui/base_button.h b/scene/gui/base_button.h index 65563ddc03..a2c640b9cf 100644 --- a/scene/gui/base_button.h +++ b/scene/gui/base_button.h @@ -83,6 +83,8 @@ public: bool is_pressed() const; ///< return wether button is pressed (toggled in) bool is_pressing() const; ///< return wether button is pressed (toggled in) + bool is_hovered() const; + void set_pressed(bool p_pressed); ///only works in toggle mode void set_toggle_mode(bool p_on); bool is_toggle_mode() const; diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 4b4b4b3c73..6878793360 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -1002,7 +1002,7 @@ void Control::_window_input_event(InputEvent p_event) { } - p_event.mouse_button.global_x = pos.x; + p_event.mouse_button.global_x = pos.x; p_event.mouse_button.global_y = pos.y; pos = window->focus_inv_xform.xform(pos); -- cgit v1.2.3