From: Eduardo Date: Tue, 26 Sep 2023 20:28:53 +0000 (+0200) Subject: moved buttons X-Git-Url: http://git.edufdez.es/?a=commitdiff_plain;h=c0fa4d268fdfcb0fb538fa7ea6959b43350eaea1;p=The%20Cutests%20To-Do%20List.git moved buttons --- diff --git a/buttons/AnimatedButton.gd b/buttons/AnimatedButton.gd deleted file mode 100644 index 345679f..0000000 --- a/buttons/AnimatedButton.gd +++ /dev/null @@ -1,21 +0,0 @@ -extends Control - -@onready var button = $Button - -func _on_button_button_down(): - animate_button_down() - -func _on_button_button_up(): - animate_button_up() - -func animate_button_down(): - var new_position = Vector2(button.position.x + 8, button.position.y + 8) - animate_button(new_position) - -func animate_button_up(): - var new_position = Vector2(button.position.x - 8, button.position.y - 8) - animate_button(new_position) - -func animate_button(b_position: Vector2): - var tween = get_tree().create_tween().set_parallel(true) - tween.tween_property(button, "position", b_position, 0.05) diff --git a/buttons/AnimatedButton.tscn b/buttons/AnimatedButton.tscn deleted file mode 100644 index f4c79be..0000000 --- a/buttons/AnimatedButton.tscn +++ /dev/null @@ -1,24 +0,0 @@ -[gd_scene load_steps=2 format=3 uid="uid://wcc3vm8lhbp6"] - -[ext_resource type="Script" path="res://buttons/AnimatedButton.gd" id="1_kw4tk"] - -[node name="AnimatedButton" type="Control"] -layout_mode = 3 -anchor_right = 1.0 -anchor_bottom = 0.078 -offset_bottom = 0.23999 -grow_horizontal = 2 -script = ExtResource("1_kw4tk") - -[node name="Button" type="Button" parent="."] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -keep_pressed_outside = true -text = "Button" - -[connection signal="button_down" from="Button" to="." method="_on_button_button_down"] -[connection signal="button_up" from="Button" to="." method="_on_button_button_up"] diff --git a/custom_elements/buttons/AnimatedButton.gd b/custom_elements/buttons/AnimatedButton.gd new file mode 100644 index 0000000..345679f --- /dev/null +++ b/custom_elements/buttons/AnimatedButton.gd @@ -0,0 +1,21 @@ +extends Control + +@onready var button = $Button + +func _on_button_button_down(): + animate_button_down() + +func _on_button_button_up(): + animate_button_up() + +func animate_button_down(): + var new_position = Vector2(button.position.x + 8, button.position.y + 8) + animate_button(new_position) + +func animate_button_up(): + var new_position = Vector2(button.position.x - 8, button.position.y - 8) + animate_button(new_position) + +func animate_button(b_position: Vector2): + var tween = get_tree().create_tween().set_parallel(true) + tween.tween_property(button, "position", b_position, 0.05) diff --git a/custom_elements/buttons/AnimatedButton.tscn b/custom_elements/buttons/AnimatedButton.tscn new file mode 100644 index 0000000..373b419 --- /dev/null +++ b/custom_elements/buttons/AnimatedButton.tscn @@ -0,0 +1,24 @@ +[gd_scene load_steps=2 format=3 uid="uid://wcc3vm8lhbp6"] + +[ext_resource type="Script" path="res://custom_elements/buttons/AnimatedButton.gd" id="1_kw4tk"] + +[node name="AnimatedButton" type="Control"] +layout_mode = 3 +anchor_right = 1.0 +anchor_bottom = 0.078 +offset_bottom = 0.23999 +grow_horizontal = 2 +script = ExtResource("1_kw4tk") + +[node name="Button" type="Button" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +keep_pressed_outside = true +text = "Button" + +[connection signal="button_down" from="Button" to="." method="_on_button_button_down"] +[connection signal="button_up" from="Button" to="." method="_on_button_button_up"] diff --git a/scenes/main_menu/MainMenu.tscn b/scenes/main_menu/MainMenu.tscn index 42b73c0..4774d2a 100644 --- a/scenes/main_menu/MainMenu.tscn +++ b/scenes/main_menu/MainMenu.tscn @@ -3,7 +3,7 @@ [ext_resource type="Script" path="res://scenes/main_menu/MainMenu.gd" id="1_yx80n"] [ext_resource type="Texture2D" uid="uid://c3q0pfh7e8xj0" path="res://themes/default/back_pain_logo_text.png" id="2_6x8ou"] [ext_resource type="Texture2D" uid="uid://bjwbk76qmspia" path="res://themes/default/main_bunny.jpg" id="3_vaxsw"] -[ext_resource type="PackedScene" uid="uid://wcc3vm8lhbp6" path="res://buttons/AnimatedButton.tscn" id="4_71840"] +[ext_resource type="PackedScene" uid="uid://wcc3vm8lhbp6" path="res://custom_elements/buttons/AnimatedButton.tscn" id="4_71840"] [ext_resource type="PackedScene" uid="uid://b3077obpgfwkx" path="res://themes/default/buttons/menu_button/MenuButton.tscn" id="5_qjr8j"] [ext_resource type="Shader" path="res://themes/default/backgrounds/home_screen_dots.gdshader" id="6_xkkpt"]