add rounded corner to popup panel

master
Fabien Freling 2020-05-29 16:55:20 +02:00
parent 42c1b2b9f5
commit e758168757
3 changed files with 18 additions and 5 deletions

View File

@ -21,10 +21,10 @@ border_width_top = 4
border_width_right = 4
border_width_bottom = 4
border_color = Color( 0.12549, 0.235294, 0.337255, 1 )
corner_radius_top_left = 4
corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4
corner_radius_top_left = 20
corner_radius_top_right = 20
corner_radius_bottom_right = 20
corner_radius_bottom_left = 20
shadow_size = 5
shadow_offset = Vector2( 0, 5 )

View File

@ -61,6 +61,7 @@ margin_bottom = 327.0
text = "HINTS"
[node name="NewGamePanel" parent="." instance=ExtResource( 3 )]
window_scale_factor = 0.9
[connection signal="state_changed" from="HSplitContainer/Taquin" to="." method="_on_Taquin_state_changed"]
[connection signal="pressed" from="HSplitContainer/VSplitContainer/New game" to="." method="_on_New_game_pressed"]
[connection signal="button_down" from="HSplitContainer/VSplitContainer/Hints" to="HSplitContainer/Taquin" method="_on_Hints_button_down"]

View File

@ -12,13 +12,25 @@ var preferences = ConfigFile.new()
var fade_duration = 0.2
var fade_scale_factor = 0.9
onready var popup = $"."
onready var panel = $Panel
onready var tween = $Tween
func _init():
var err = preferences.load(pref_path)
func _ready():
pass
assert(popup.theme != null)
var popup_style : = popup.get_stylebox("panel", "PopupPanel") as StyleBoxFlat
assert(popup_style != null)
var panel_style := panel.get_stylebox("panel", "Panel") as StyleBoxFlat
assert(panel_style != null)
var modified_panel_style = panel_style.duplicate()
modified_panel_style.corner_radius_bottom_left = popup_style.corner_radius_bottom_left
modified_panel_style.corner_radius_bottom_right = popup_style.corner_radius_bottom_right
modified_panel_style.corner_radius_top_left = popup_style.corner_radius_top_left
modified_panel_style.corner_radius_top_right = popup_style.corner_radius_top_right
panel.set("custom_styles/panel", modified_panel_style)
func fade_out():
tween.remove_all()