diff options
author | romulox_x <romulox_x@yahoo.com> | 2015-01-02 20:23:52 -0800 |
---|---|---|
committer | romulox_x <romulox_x@yahoo.com> | 2015-01-02 20:23:52 -0800 |
commit | c83a00c603c84eeac2188cae6b4986c3b86a05c6 (patch) | |
tree | fa18e98ecbd4c922feb757008933325cc0ce38b0 /scene | |
parent | fa7a3ac0d329f7e3e7ade9cd530880af2da7b7dd (diff) |
Changed texturebutton scale from float to Size2
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/texture_button.cpp | 13 | ||||
-rw-r--r-- | scene/gui/texture_button.h | 6 |
2 files changed, 11 insertions, 8 deletions
diff --git a/scene/gui/texture_button.cpp b/scene/gui/texture_button.cpp index e8967927cb..1a7087b7ef 100644 --- a/scene/gui/texture_button.cpp +++ b/scene/gui/texture_button.cpp @@ -53,6 +53,10 @@ Size2 TextureButton::get_minimum_size() const { bool TextureButton::has_point(const Point2& p_point) const { + if (scale[0] <= 0 || scale[1] <= 0) { + return false; + } + Point2 ppos = p_point/scale; if (click_mask.is_valid()) { @@ -159,7 +163,7 @@ void TextureButton::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"textures/disabled",PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_disabled_texture"), _SCS("get_disabled_texture")); ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"textures/focused",PROPERTY_HINT_RESOURCE_TYPE,"Texture"), _SCS("set_focused_texture"), _SCS("get_focused_texture")); ADD_PROPERTY(PropertyInfo(Variant::OBJECT,"textures/click_mask",PROPERTY_HINT_RESOURCE_TYPE,"BitMap"), _SCS("set_click_mask"), _SCS("get_click_mask")) ; - ADD_PROPERTY(PropertyInfo(Variant::REAL,"params/scale",PROPERTY_HINT_RANGE,"0.01,1024,0.01"), _SCS("set_scale"), _SCS("get_scale")); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR2,"params/scale",PROPERTY_HINT_RANGE,"0.01,1024,0.01"), _SCS("set_scale"), _SCS("get_scale")); ADD_PROPERTY(PropertyInfo(Variant::COLOR,"params/modulate"), _SCS("set_modulate"), _SCS("get_modulate")); } @@ -228,15 +232,14 @@ void TextureButton::set_focused_texture(const Ref<Texture>& p_focused) { focused = p_focused; }; -void TextureButton::set_scale(float p_scale) { +void TextureButton::set_scale(Size2 p_scale) { - ERR_FAIL_COND(p_scale<=0); scale=p_scale; minimum_size_changed(); update(); } -float TextureButton::get_scale() const{ +Size2 TextureButton::get_scale() const{ return scale; } @@ -252,6 +255,6 @@ Color TextureButton::get_modulate() const { TextureButton::TextureButton() { - scale=1.0; + scale=Size2(1.0, 1.0); modulate=Color(1,1,1); } diff --git a/scene/gui/texture_button.h b/scene/gui/texture_button.h index 0209d3c260..94bc53b3ff 100644 --- a/scene/gui/texture_button.h +++ b/scene/gui/texture_button.h @@ -41,7 +41,7 @@ class TextureButton : public BaseButton { Ref<Texture> disabled; Ref<Texture> focused; Ref<BitMap> click_mask; - float scale; + Size2 scale; Color modulate; @@ -68,8 +68,8 @@ public: Ref<Texture> get_focused_texture() const; Ref<BitMap> get_click_mask() const; - void set_scale(float p_scale); - float get_scale() const; + void set_scale(Size2 p_scale); + Size2 get_scale() const; void set_modulate(const Color& p_modulate); Color get_modulate() const; |