From 8a89db1620bbd3461ca694c58b76ec0cc7066adc Mon Sep 17 00:00:00 2001 From: Eduardo Date: Mon, 25 Sep 2023 18:17:51 +0200 Subject: [PATCH] to do list screen background made with a shader! --- scenes/todo_list/ToDoList.tscn | 13 ++++++++++- .../to-do_list_screen_lines.gdshader | 22 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 themes/default/backgrounds/to-do_list_screen_lines.gdshader diff --git a/scenes/todo_list/ToDoList.tscn b/scenes/todo_list/ToDoList.tscn index a0f4903..b5bb05d 100644 --- a/scenes/todo_list/ToDoList.tscn +++ b/scenes/todo_list/ToDoList.tscn @@ -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 index 0000000..1af3b0a --- /dev/null +++ b/themes/default/backgrounds/to-do_list_screen_lines.gdshader @@ -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; + } + } + } + +} -- 2.30.2