aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde2017-04-11 19:45:39 +0200
committerRémi Verschelde2017-04-11 19:45:39 +0200
commitd8ae244d51ed157d96346c510baeb637239e3200 (patch)
treed3dd20fe69500fd4e3f4e8fd8afd69609735d136
parent8df5b7151f9682e851b6c1c9ff1e13a32190b532 (diff)
downloadgodot-2.1.3-stable.tar.gz
godot-2.1.3-stable.tar.zst
godot-2.1.3-stable.zip
-rw-r--r--scene/gui/button.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp
index dc76428c3..1ed434790 100644
--- a/scene/gui/button.cpp
+++ b/scene/gui/button.cpp
@@ -65,21 +65,17 @@ void Button::_notification(int p_what) {
//print_line(get_text()+": "+itos(is_flat())+" hover "+itos(get_draw_mode()));
- Ref<StyleBox> style = get_stylebox("normal");
-
switch (get_draw_mode()) {
case DRAW_NORMAL: {
- style = get_stylebox("normal");
if (!flat)
- style->draw(ci, Rect2(Point2(0, 0), size));
+ get_stylebox("normal")->draw(ci, Rect2(Point2(0, 0), size));
color = get_color("font_color");
} break;
case DRAW_PRESSED: {
- style = get_stylebox("pressed");
- style->draw(ci, Rect2(Point2(0, 0), size));
+ get_stylebox("pressed")->draw(ci, Rect2(Point2(0, 0), size));
if (has_color("font_color_pressed"))
color = get_color("font_color_pressed");
else
@@ -88,15 +84,13 @@ void Button::_notification(int p_what) {
} break;
case DRAW_HOVER: {
- style = get_stylebox("hover");
- style->draw(ci, Rect2(Point2(0, 0), size));
+ get_stylebox("hover")->draw(ci, Rect2(Point2(0, 0), size));
color = get_color("font_color_hover");
} break;
case DRAW_DISABLED: {
- style = get_stylebox("disabled");
- style->draw(ci, Rect2(Point2(0, 0), size));
+ get_stylebox("disabled")->draw(ci, Rect2(Point2(0, 0), size));
color = get_color("font_color_disabled");
} break;
@@ -108,6 +102,7 @@ void Button::_notification(int p_what) {
style->draw(ci, Rect2(Point2(), size));
}
+ Ref<StyleBox> style = get_stylebox("normal");
Ref<Font> font = get_font("font");
Ref<Texture> _icon;
if (icon.is_null() && has_icon("icon"))