Added UI blur
This commit is contained in:
parent
19c1d3e74c
commit
3ba39992bc
@ -11,13 +11,20 @@ var progress: Array
|
||||
func _ready():
|
||||
ResourceLoader.load_threaded_request(scene_path, "", use_sub_threads)
|
||||
|
||||
if OS.has_feature("editor"):
|
||||
fade_duration /= 2
|
||||
|
||||
func _process(_delta):
|
||||
var status := ResourceLoader.load_threaded_get_status(scene_path, progress)
|
||||
progress_bar.value = progress[0] * 100
|
||||
|
||||
if status == ResourceLoader.THREAD_LOAD_LOADED:
|
||||
add_scene()
|
||||
fade_out()
|
||||
on_loaded()
|
||||
set_process(false)
|
||||
|
||||
func on_loaded():
|
||||
add_scene()
|
||||
fade_out()
|
||||
|
||||
func add_scene():
|
||||
var scene := ResourceLoader.load_threaded_get(scene_path)
|
||||
|
@ -1,6 +1,7 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://ds5dynfon316"]
|
||||
[gd_scene load_steps=3 format=3 uid="uid://ds5dynfon316"]
|
||||
|
||||
[ext_resource type="Script" path="res://Start.gd" id="1_8y1vx"]
|
||||
[ext_resource type="PackedScene" uid="uid://dvharlvkq4m0f" path="res://ui/blur/BlurRect.tscn" id="2_xfrfu"]
|
||||
|
||||
[node name="Start" type="CanvasLayer" node_paths=PackedStringArray("progress_bar", "modulate")]
|
||||
layer = 128
|
||||
@ -8,11 +9,14 @@ script = ExtResource("1_8y1vx")
|
||||
scene_path = "Main.tscn"
|
||||
progress_bar = NodePath("MarginContainer/Progress")
|
||||
modulate = NodePath("CanvasModulate")
|
||||
fade_duration = 0.75
|
||||
fade_duration = 2.0
|
||||
|
||||
[node name="CanvasModulate" type="CanvasModulate" parent="."]
|
||||
|
||||
[node name="Background" type="ColorRect" parent="."]
|
||||
[node name="BlurRect" parent="." instance=ExtResource("2_xfrfu")]
|
||||
color = Color(0.12549, 0.12549, 0.12549, 1)
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
|
10
client/ui/blur/Blur.gdshader
Normal file
10
client/ui/blur/Blur.gdshader
Normal file
@ -0,0 +1,10 @@
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;
|
||||
|
||||
uniform float blur: hint_range(0.0, 5.0) = 3.0;
|
||||
|
||||
void fragment() {
|
||||
vec4 color = textureLod(SCREEN_TEXTURE, SCREEN_UV, blur);
|
||||
COLOR = vec4(color.rgb, 1.0);
|
||||
}
|
6
client/ui/blur/BlurContainer.tscn
Normal file
6
client/ui/blur/BlurContainer.tscn
Normal file
@ -0,0 +1,6 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://c73k6kaoj2bdd"]
|
||||
|
||||
[ext_resource type="Material" uid="uid://lc7tfhw1slhf" path="res://ui/blur/BlurMaterial.tres" id="1_fal0j"]
|
||||
|
||||
[node name="BlurContainer" type="PanelContainer"]
|
||||
material = ExtResource("1_fal0j")
|
7
client/ui/blur/BlurMaterial.tres
Normal file
7
client/ui/blur/BlurMaterial.tres
Normal file
@ -0,0 +1,7 @@
|
||||
[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://lc7tfhw1slhf"]
|
||||
|
||||
[ext_resource type="Shader" path="res://ui/blur/Blur.gdshader" id="1_pkjrr"]
|
||||
|
||||
[resource]
|
||||
shader = ExtResource("1_pkjrr")
|
||||
shader_parameter/blur = 3.0
|
12
client/ui/blur/BlurRect.tscn
Normal file
12
client/ui/blur/BlurRect.tscn
Normal file
@ -0,0 +1,12 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://dvharlvkq4m0f"]
|
||||
|
||||
[ext_resource type="Material" uid="uid://lc7tfhw1slhf" path="res://ui/blur/BlurMaterial.tres" id="1_4yub6"]
|
||||
|
||||
[node name="BlurRect" type="ColorRect"]
|
||||
material = ExtResource("1_4yub6")
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
Loading…
Reference in New Issue
Block a user