to do list screen background
authorEduardo <[email protected]>
Mon, 25 Sep 2023 16:17:51 +0000 (18:17 +0200)
committerEduardo <[email protected]>
Mon, 25 Sep 2023 16:17:51 +0000 (18:17 +0200)
made with a shader!

scenes/todo_list/ToDoList.tscn
themes/default/backgrounds/to-do_list_screen_lines.gdshader [new file with mode: 0644]

index a0f49031ad748a6a6694c80ec5e74a31303f809a..b5bb05dc822d52a446c729ad8bbca65e39b538da 100644 (file)
@@ -1,14 +1,25 @@
-[gd_scene load_steps=3 format=3 uid="uid://btijm1swt1mj4"]
+[gd_scene load_steps=5 format=3 uid="uid://btijm1swt1mj4"]
 
 [ext_resource type="Script" path="res://scenes/todo_list/ToDoList.gd" id="1_733o8"]
+[ext_resource type="Shader" path="res://themes/default/backgrounds/to-do_list_screen_lines.gdshader" id="2_tsopu"]
 [ext_resource type="PackedScene" uid="uid://wcc3vm8lhbp6" path="res://buttons/AnimatedButton.tscn" id="2_xdr44"]
 
+[sub_resource type="ShaderMaterial" id="ShaderMaterial_uiqg4"]
+shader = ExtResource("2_tsopu")
+shader_parameter/line_color = Vector4(1, 0.78, 0.73, 1)
+shader_parameter/line_width = 6.0
+shader_parameter/interline_space = 100.0
+shader_parameter/right_line_space = 150.0
+shader_parameter/start_lines = 250.0
+shader_parameter/position = 0.07
+
 [node name="ToDoList" type="Node"]
 script = ExtResource("1_733o8")
 metadata/_edit_horizontal_guides_ = [1848.0]
 metadata/_edit_vertical_guides_ = [1029.0]
 
 [node name="Background" type="ColorRect" parent="."]
+material = SubResource("ShaderMaterial_uiqg4")
 anchors_preset = 15
 anchor_right = 1.0
 anchor_bottom = 1.0
diff --git a/themes/default/backgrounds/to-do_list_screen_lines.gdshader b/themes/default/backgrounds/to-do_list_screen_lines.gdshader
new file mode 100644 (file)
index 0000000..1af3b0a
--- /dev/null
@@ -0,0 +1,22 @@
+shader_type canvas_item;
+
+uniform vec4 line_color = vec4(1, 0.78, 0.73, 1);
+uniform float line_width = 6.0;
+uniform float interline_space = 100.0;
+uniform float right_line_space = 150.0;
+uniform float start_lines = 250.0;
+uniform float position: hint_range(0.0, 1.0, 0.01) = .07;
+
+void fragment() {
+       if(FRAGCOORD.y > start_lines) {
+               if(mod(FRAGCOORD.y + start_lines, interline_space) < line_width) {
+                       COLOR = line_color;
+               }
+               if(FRAGCOORD.x > line_width) {
+                       if(mod(FRAGCOORD.x, 1. / SCREEN_PIXEL_SIZE.x - right_line_space) < line_width) {
+                               COLOR = line_color;
+                       }
+               }
+       }
+
+}