New music and multipass canvas
This commit is contained in:
		
							parent
							
								
									2e91da4295
								
							
						
					
					
						commit
						45c91bce39
					
				
					 9 changed files with 247 additions and 77 deletions
				
			
		
							
								
								
									
										6
									
								
								assets/auto_scale.tscn
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								assets/auto_scale.tscn
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,6 @@ | |||
| [gd_scene load_steps=2 format=3 uid="uid://br7cnj1spc4rk"] | ||||
| 
 | ||||
| [ext_resource type="Script" path="res://scripts/auto_scale.gd" id="1_vp1nj"] | ||||
| 
 | ||||
| [node name="AutoScale" type="Node"] | ||||
| script = ExtResource("1_vp1nj") | ||||
							
								
								
									
										
											BIN
										
									
								
								assets/bgm.ogg
									
										
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								assets/bgm.ogg
									
										
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							|  | @ -2,7 +2,7 @@ | |||
| 
 | ||||
| importer="oggvorbisstr" | ||||
| type="AudioStreamOggVorbis" | ||||
| uid="uid://35rb6724glhc" | ||||
| uid="uid://djj201gjpdpv3" | ||||
| path="res://.godot/imported/bgm.ogg-e1728340e2c8938587d9482b715a001a.oggvorbisstr" | ||||
| 
 | ||||
| [deps] | ||||
|  |  | |||
							
								
								
									
										44
									
								
								assets/shaders/cromatic-abberation.gdshader
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								assets/shaders/cromatic-abberation.gdshader
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,44 @@ | |||
| //shader by CasualGarageCoder, updated to Godot 4 | ||||
| shader_type canvas_item; | ||||
| 
 | ||||
| uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap; | ||||
| 
 | ||||
| uniform float chaos : hint_range(0., 32.) = 1.; | ||||
| uniform float radius : hint_range(0., 1.) = 0.5; | ||||
| uniform float attenuation : hint_range(1., 5.) = 2.; | ||||
| 
 | ||||
| varying vec2 amount_r; | ||||
| varying vec2 amount_g; | ||||
| varying vec2 amount_b; | ||||
| 
 | ||||
| float rand(vec2 co){ | ||||
|     return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453) - .5; | ||||
| } | ||||
| 
 | ||||
| void vertex() { | ||||
|     vec2 shifted_uv = (UV * 2.) - 1.; | ||||
|     amount_r = normalize( | ||||
|         vec2(rand(TIME * 1.3 * shifted_uv), | ||||
|         rand(TIME * 1.64 * shifted_uv))); | ||||
|     amount_g = normalize( | ||||
|         vec2(rand(TIME * 1.5 * shifted_uv), | ||||
|         rand(TIME * 1.7 * shifted_uv))); | ||||
|     amount_b = normalize( | ||||
|         vec2(rand(TIME * 1.17 * shifted_uv), | ||||
|         rand(TIME * 1.23 * shifted_uv))); | ||||
| } | ||||
| 
 | ||||
| void fragment() { | ||||
|     vec2 chaos_v = vec2(chaos, -chaos) * SCREEN_PIXEL_SIZE; | ||||
|      | ||||
|     float dist = length((UV - vec2(0.5)) * 2.); | ||||
|     float att = clamp(dist / radius, 0., 1.); | ||||
|      | ||||
|     chaos_v *= 1. - pow(att, attenuation); | ||||
|      | ||||
|     COLOR = vec4( | ||||
|         texture(TEXTURE, SCREEN_UV + chaos_v * amount_r).r, | ||||
|         texture(TEXTURE, SCREEN_UV + chaos_v * amount_g).g, | ||||
|         texture(TEXTURE, SCREEN_UV + chaos_v * amount_b).b, | ||||
|         1.); | ||||
| } | ||||
							
								
								
									
										12
									
								
								assets/shaders/pixelate.gdshader
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								assets/shaders/pixelate.gdshader
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,12 @@ | |||
| shader_type canvas_item; | ||||
| 
 | ||||
| uniform int x_pixel_size : hint_range(1, 100); | ||||
| uniform int y_pixel_size : hint_range(1, 100); | ||||
| 
 | ||||
| void fragment() { | ||||
| 	vec2 correction = TEXTURE_PIXEL_SIZE * vec2(float(x_pixel_size), float(y_pixel_size)) / vec2(2.0); | ||||
| 	vec2 texture_uv = floor(UV / TEXTURE_PIXEL_SIZE); | ||||
| 	vec2 offset = vec2(float(int(texture_uv.x) % x_pixel_size), float(int(texture_uv.y) % y_pixel_size)); | ||||
| 	vec2 target = (texture_uv - offset) * TEXTURE_PIXEL_SIZE; | ||||
| 	COLOR = texture(TEXTURE, target + correction ); | ||||
| } | ||||
|  | @ -1,15 +1,15 @@ | |||
| [gd_scene load_steps=13 format=3 uid="uid://b761uk7sjprrp"] | ||||
| [gd_scene load_steps=22 format=3 uid="uid://b761uk7sjprrp"] | ||||
| 
 | ||||
| [ext_resource type="Shader" path="res://assets/shaders/kaleidoscope.gdshader" id="1_nwvg1"] | ||||
| [ext_resource type="PackedScene" uid="uid://qehbjfkqs5pl" path="res://entities/ParticlesCool.tscn" id="1_yc1r8"] | ||||
| [ext_resource type="PackedScene" uid="uid://br7cnj1spc4rk" path="res://assets/auto_scale.tscn" id="2_7v8f2"] | ||||
| [ext_resource type="Shader" path="res://assets/shaders/pixelate.gdshader" id="4_lvys8"] | ||||
| [ext_resource type="Shader" path="res://assets/shaders/cromatic-abberation.gdshader" id="5_w16wy"] | ||||
| 
 | ||||
| [sub_resource type="GDScript" id="GDScript_mtsk5"] | ||||
| script/source = "extends Control | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| func _on_timer_timeout() -> void: | ||||
| 	$AnimationPlayer.play(\"kaleidoskope_1\"); | ||||
| " | ||||
|  | @ -67,64 +67,12 @@ shader_parameter/enabled = null | |||
| [sub_resource type="ViewportTexture" id="ViewportTexture_b44mw"] | ||||
| viewport_path = NodePath("TextViewPort") | ||||
| 
 | ||||
| [sub_resource type="Animation" id="Animation_olvxy"] | ||||
| resource_name = "kaleidoskope_1" | ||||
| length = 20.0 | ||||
| tracks/0/type = "value" | ||||
| tracks/0/imported = false | ||||
| tracks/0/enabled = true | ||||
| tracks/0/path = NodePath("Kaleido:material:shader_parameter/segments") | ||||
| tracks/0/interp = 1 | ||||
| tracks/0/loop_wrap = true | ||||
| tracks/0/keys = { | ||||
| "times": PackedFloat32Array(0.0333334, 1.06667, 2.1, 3.06667, 4.06667, 5.06667, 6.03333, 7.1, 8.13333, 9.1), | ||||
| "transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1), | ||||
| "update": 1, | ||||
| "values": [4.0, 6.0, 8.0, 10.0, 12.0, 8.0, 4.0, 6.0, 8.0, 6.0] | ||||
| } | ||||
| tracks/1/type = "value" | ||||
| tracks/1/imported = false | ||||
| tracks/1/enabled = true | ||||
| tracks/1/path = NodePath("Kaleido:material:shader_parameter/sourceAngle") | ||||
| tracks/1/interp = 1 | ||||
| tracks/1/loop_wrap = true | ||||
| tracks/1/keys = { | ||||
| "times": PackedFloat32Array(0, 1.03333), | ||||
| "transitions": PackedFloat32Array(1, 1), | ||||
| "update": 0, | ||||
| "values": [0.0, 0.0] | ||||
| } | ||||
| tracks/2/type = "value" | ||||
| tracks/2/imported = false | ||||
| tracks/2/enabled = true | ||||
| tracks/2/path = NodePath("Kaleido:material:shader_parameter/sourceOffset") | ||||
| tracks/2/interp = 1 | ||||
| tracks/2/loop_wrap = true | ||||
| tracks/2/keys = { | ||||
| "times": PackedFloat32Array(0.0333333, 9.1, 11.5333, 15.0667), | ||||
| "transitions": PackedFloat32Array(1, 1, 1, 1), | ||||
| "update": 0, | ||||
| "values": [Vector2(0.5, 0.5), Vector2(0.5, 0.5), Vector2(0.5, 0), Vector2(1, -1)] | ||||
| } | ||||
| tracks/3/type = "value" | ||||
| tracks/3/imported = false | ||||
| tracks/3/enabled = true | ||||
| tracks/3/path = NodePath("TextMask:material:shader_parameter/enabled") | ||||
| tracks/3/interp = 1 | ||||
| tracks/3/loop_wrap = true | ||||
| tracks/3/keys = { | ||||
| "times": PackedFloat32Array(0, 11.8), | ||||
| "transitions": PackedFloat32Array(1, 1), | ||||
| "update": 1, | ||||
| "values": [false, true] | ||||
| } | ||||
| 
 | ||||
| [sub_resource type="Animation" id="Animation_1yxhh"] | ||||
| length = 0.001 | ||||
| tracks/0/type = "value" | ||||
| tracks/0/imported = false | ||||
| tracks/0/enabled = true | ||||
| tracks/0/path = NodePath("Kaleido:material:shader_parameter/segments") | ||||
| tracks/0/path = NodePath("KaleidoViewport/Kaleido:material:shader_parameter/segments") | ||||
| tracks/0/interp = 1 | ||||
| tracks/0/loop_wrap = true | ||||
| tracks/0/keys = { | ||||
|  | @ -136,7 +84,7 @@ tracks/0/keys = { | |||
| tracks/1/type = "value" | ||||
| tracks/1/imported = false | ||||
| tracks/1/enabled = true | ||||
| tracks/1/path = NodePath("Kaleido:material:shader_parameter/sourceAngle") | ||||
| tracks/1/path = NodePath("KaleidoViewport/Kaleido:material:shader_parameter/sourceAngle") | ||||
| tracks/1/interp = 1 | ||||
| tracks/1/loop_wrap = true | ||||
| tracks/1/keys = { | ||||
|  | @ -148,7 +96,7 @@ tracks/1/keys = { | |||
| tracks/2/type = "value" | ||||
| tracks/2/imported = false | ||||
| tracks/2/enabled = true | ||||
| tracks/2/path = NodePath("Kaleido:material:shader_parameter/sourceOffset") | ||||
| tracks/2/path = NodePath("KaleidoViewport/Kaleido:material:shader_parameter/sourceOffset") | ||||
| tracks/2/interp = 1 | ||||
| tracks/2/loop_wrap = true | ||||
| tracks/2/keys = { | ||||
|  | @ -170,6 +118,58 @@ tracks/3/keys = { | |||
| "values": [null] | ||||
| } | ||||
| 
 | ||||
| [sub_resource type="Animation" id="Animation_olvxy"] | ||||
| resource_name = "kaleidoskope_1" | ||||
| length = 20.0 | ||||
| tracks/0/type = "value" | ||||
| tracks/0/imported = false | ||||
| tracks/0/enabled = true | ||||
| tracks/0/path = NodePath("KaleidoViewport/Kaleido:material:shader_parameter/segments") | ||||
| tracks/0/interp = 1 | ||||
| tracks/0/loop_wrap = true | ||||
| tracks/0/keys = { | ||||
| "times": PackedFloat32Array(0.0333334, 1.06667, 2.1, 3.06667, 4.06667, 5.06667, 6.03333, 7.1, 8.13333, 9.1), | ||||
| "transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1), | ||||
| "update": 1, | ||||
| "values": [4.0, 6.0, 8.0, 10.0, 12.0, 8.0, 4.0, 6.0, 8.0, 6.0] | ||||
| } | ||||
| tracks/1/type = "value" | ||||
| tracks/1/imported = false | ||||
| tracks/1/enabled = true | ||||
| tracks/1/path = NodePath("KaleidoViewport/Kaleido:material:shader_parameter/sourceAngle") | ||||
| tracks/1/interp = 1 | ||||
| tracks/1/loop_wrap = true | ||||
| tracks/1/keys = { | ||||
| "times": PackedFloat32Array(0, 1.03333), | ||||
| "transitions": PackedFloat32Array(1, 1), | ||||
| "update": 0, | ||||
| "values": [0.0, 0.0] | ||||
| } | ||||
| tracks/2/type = "value" | ||||
| tracks/2/imported = false | ||||
| tracks/2/enabled = true | ||||
| tracks/2/path = NodePath("KaleidoViewport/Kaleido:material:shader_parameter/sourceOffset") | ||||
| tracks/2/interp = 1 | ||||
| tracks/2/loop_wrap = true | ||||
| tracks/2/keys = { | ||||
| "times": PackedFloat32Array(0.0333333, 9.1, 11.5333, 15.0667), | ||||
| "transitions": PackedFloat32Array(1, 1, 1, 1), | ||||
| "update": 0, | ||||
| "values": [Vector2(0.5, 0.5), Vector2(0.5, 0.5), Vector2(0.5, 0), Vector2(1, -1)] | ||||
| } | ||||
| tracks/3/type = "value" | ||||
| tracks/3/imported = false | ||||
| tracks/3/enabled = true | ||||
| tracks/3/path = NodePath("TextMask:material:shader_parameter/enabled") | ||||
| tracks/3/interp = 1 | ||||
| tracks/3/loop_wrap = true | ||||
| tracks/3/keys = { | ||||
| "times": PackedFloat32Array(0, 11.8), | ||||
| "transitions": PackedFloat32Array(1, 1), | ||||
| "update": 1, | ||||
| "values": [false, true] | ||||
| } | ||||
| 
 | ||||
| [sub_resource type="AnimationLibrary" id="AnimationLibrary_4qo5x"] | ||||
| _data = { | ||||
| "RESET": SubResource("Animation_1yxhh"), | ||||
|  | @ -180,6 +180,29 @@ _data = { | |||
| font_size = 104 | ||||
| shadow_size = 0 | ||||
| 
 | ||||
| [sub_resource type="ShaderMaterial" id="ShaderMaterial_riy6b"] | ||||
| shader = ExtResource("4_lvys8") | ||||
| shader_parameter/x_pixel_size = 1 | ||||
| shader_parameter/y_pixel_size = 15 | ||||
| 
 | ||||
| [sub_resource type="ViewportTexture" id="ViewportTexture_ff16u"] | ||||
| viewport_path = NodePath("KaleidoViewport") | ||||
| 
 | ||||
| [sub_resource type="ShaderMaterial" id="ShaderMaterial_wyd4s"] | ||||
| shader = ExtResource("5_w16wy") | ||||
| shader_parameter/chaos = 32.0 | ||||
| shader_parameter/radius = 1.0 | ||||
| shader_parameter/attenuation = 1.5 | ||||
| 
 | ||||
| [sub_resource type="ViewportTexture" id="ViewportTexture_3bfaj"] | ||||
| viewport_path = NodePath("RandomPasses/Pass1") | ||||
| 
 | ||||
| [sub_resource type="ViewportTexture" id="ViewportTexture_rmol4"] | ||||
| viewport_path = NodePath("RandomPasses/Pass2") | ||||
| 
 | ||||
| [sub_resource type="ViewportTexture" id="ViewportTexture_wumee"] | ||||
| viewport_path = NodePath("RandomPasses/Pass3") | ||||
| 
 | ||||
| [node name="KaleidoScope" type="Control"] | ||||
| layout_mode = 3 | ||||
| anchors_preset = 15 | ||||
|  | @ -189,15 +212,21 @@ grow_horizontal = 2 | |||
| grow_vertical = 2 | ||||
| script = SubResource("GDScript_mtsk5") | ||||
| 
 | ||||
| [node name="Kaleido" type="TextureRect" parent="."] | ||||
| [node name="KaleidoViewport" type="SubViewport" parent="."] | ||||
| size = Vector2i(1152, 648) | ||||
| 
 | ||||
| [node name="Kaleido" type="TextureRect" parent="KaleidoViewport"] | ||||
| material = SubResource("ShaderMaterial_a6cuy") | ||||
| layout_mode = 1 | ||||
| anchors_preset = 15 | ||||
| anchor_right = 1.0 | ||||
| anchor_bottom = 1.0 | ||||
| grow_horizontal = 2 | ||||
| grow_vertical = 2 | ||||
| texture = SubResource("ViewportTexture_1y4ry") | ||||
| expand_mode = 2 | ||||
| stretch_mode = 6 | ||||
| 
 | ||||
| [node name="AutoScale" parent="KaleidoViewport" instance=ExtResource("2_7v8f2")] | ||||
| 
 | ||||
| [node name="TextMask" type="TextureRect" parent="."] | ||||
| material = SubResource("ShaderMaterial_ahqjw") | ||||
|  | @ -217,6 +246,8 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2.31619) | |||
| 
 | ||||
| [node name="Node3D" parent="SubViewport" instance=ExtResource("1_yc1r8")] | ||||
| 
 | ||||
| [node name="AutoScale" parent="SubViewport" instance=ExtResource("2_7v8f2")] | ||||
| 
 | ||||
| [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] | ||||
| transform = Transform3D(1, 0, 0, 0, 0.910979, 0.412453, 0, -0.412453, 0.910979, 0, 0, 0) | ||||
| 
 | ||||
|  | @ -234,6 +265,7 @@ transparent_bg = true | |||
| size = Vector2i(1152, 648) | ||||
| 
 | ||||
| [node name="Label" type="Label" parent="TextViewPort"] | ||||
| visible = false | ||||
| anchors_preset = 8 | ||||
| anchor_left = 0.5 | ||||
| anchor_top = 0.5 | ||||
|  | @ -248,4 +280,59 @@ grow_vertical = 2 | |||
| text = "THIS IS SOME TEXT" | ||||
| label_settings = SubResource("LabelSettings_n61ct") | ||||
| 
 | ||||
| [node name="AutoScale" parent="TextViewPort" instance=ExtResource("2_7v8f2")] | ||||
| 
 | ||||
| [node name="RandomPasses" type="Control" parent="."] | ||||
| layout_mode = 1 | ||||
| anchors_preset = 15 | ||||
| anchor_right = 1.0 | ||||
| anchor_bottom = 1.0 | ||||
| grow_horizontal = 2 | ||||
| grow_vertical = 2 | ||||
| 
 | ||||
| [node name="Pass1" type="SubViewport" parent="RandomPasses"] | ||||
| size = Vector2i(1152, 648) | ||||
| 
 | ||||
| [node name="TextureRect" type="TextureRect" parent="RandomPasses/Pass1"] | ||||
| material = SubResource("ShaderMaterial_riy6b") | ||||
| anchors_preset = 15 | ||||
| anchor_right = 1.0 | ||||
| anchor_bottom = 1.0 | ||||
| grow_horizontal = 2 | ||||
| grow_vertical = 2 | ||||
| texture = SubResource("ViewportTexture_ff16u") | ||||
| 
 | ||||
| [node name="AutoScale" parent="RandomPasses/Pass1" instance=ExtResource("2_7v8f2")] | ||||
| 
 | ||||
| [node name="Pass2" type="SubViewport" parent="RandomPasses"] | ||||
| size = Vector2i(1152, 648) | ||||
| 
 | ||||
| [node name="TextureRect" type="TextureRect" parent="RandomPasses/Pass2"] | ||||
| material = SubResource("ShaderMaterial_wyd4s") | ||||
| offset_right = 40.0 | ||||
| offset_bottom = 40.0 | ||||
| texture = SubResource("ViewportTexture_3bfaj") | ||||
| 
 | ||||
| [node name="AutoScale" parent="RandomPasses/Pass2" instance=ExtResource("2_7v8f2")] | ||||
| 
 | ||||
| [node name="Pass3" type="SubViewport" parent="RandomPasses"] | ||||
| size = Vector2i(1152, 648) | ||||
| 
 | ||||
| [node name="TextureRect" type="TextureRect" parent="RandomPasses/Pass3"] | ||||
| material = SubResource("ShaderMaterial_wyd4s") | ||||
| offset_right = 40.0 | ||||
| offset_bottom = 40.0 | ||||
| texture = SubResource("ViewportTexture_rmol4") | ||||
| 
 | ||||
| [node name="AutoScale" parent="RandomPasses/Pass3" instance=ExtResource("2_7v8f2")] | ||||
| 
 | ||||
| [node name="Output" type="TextureRect" parent="."] | ||||
| layout_mode = 1 | ||||
| anchors_preset = 15 | ||||
| anchor_right = 1.0 | ||||
| anchor_bottom = 1.0 | ||||
| grow_horizontal = 2 | ||||
| grow_vertical = 2 | ||||
| texture = SubResource("ViewportTexture_wumee") | ||||
| 
 | ||||
| [connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"] | ||||
|  |  | |||
|  | @ -23,6 +23,21 @@ font_size = 48 | |||
| [sub_resource type="LabelSettings" id="LabelSettings_78g6a"] | ||||
| font_size = 48 | ||||
| 
 | ||||
| [sub_resource type="Animation" id="Animation_dirfa"] | ||||
| length = 0.001 | ||||
| tracks/0/type = "value" | ||||
| tracks/0/imported = false | ||||
| tracks/0/enabled = true | ||||
| tracks/0/path = NodePath("Label:visible") | ||||
| tracks/0/interp = 1 | ||||
| tracks/0/loop_wrap = true | ||||
| tracks/0/keys = { | ||||
| "times": PackedFloat32Array(0), | ||||
| "transitions": PackedFloat32Array(1), | ||||
| "update": 1, | ||||
| "values": [true] | ||||
| } | ||||
| 
 | ||||
| [sub_resource type="Animation" id="Animation_t3ulj"] | ||||
| resource_name = "blink" | ||||
| length = 2.0 | ||||
|  | @ -40,21 +55,6 @@ tracks/0/keys = { | |||
| "values": [false, true] | ||||
| } | ||||
| 
 | ||||
| [sub_resource type="Animation" id="Animation_dirfa"] | ||||
| length = 0.001 | ||||
| tracks/0/type = "value" | ||||
| tracks/0/imported = false | ||||
| tracks/0/enabled = true | ||||
| tracks/0/path = NodePath("Label:visible") | ||||
| tracks/0/interp = 1 | ||||
| tracks/0/loop_wrap = true | ||||
| tracks/0/keys = { | ||||
| "times": PackedFloat32Array(0), | ||||
| "transitions": PackedFloat32Array(1), | ||||
| "update": 1, | ||||
| "values": [true] | ||||
| } | ||||
| 
 | ||||
| [sub_resource type="AnimationLibrary" id="AnimationLibrary_jgx00"] | ||||
| _data = { | ||||
| "RESET": SubResource("Animation_dirfa"), | ||||
|  | @ -87,6 +87,7 @@ texture = ExtResource("1_3phrh") | |||
| speed = 5.0 | ||||
| duration = 0.05 | ||||
| infinite = false | ||||
| layout_mode = 0 | ||||
| offset_right = 40.0 | ||||
| offset_bottom = 23.0 | ||||
| text = "LOADING DEMO..." | ||||
|  |  | |||
|  | @ -19,3 +19,8 @@ config/icon="res://icon.svg" | |||
| 
 | ||||
| gdscript/warnings/unassigned_variable=2 | ||||
| gdscript/warnings/untyped_declaration=2 | ||||
| 
 | ||||
| [display] | ||||
| 
 | ||||
| window/size/viewport_width=1920 | ||||
| window/size/viewport_height=1080 | ||||
|  |  | |||
							
								
								
									
										15
									
								
								scripts/auto_scale.gd
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								scripts/auto_scale.gd
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,15 @@ | |||
| # THIS SCRIPT WILL BE ADDED AS PART OF MiniDemoTools soon | ||||
| extends Node | ||||
| 
 | ||||
| 
 | ||||
| # Called when the node enters the scene tree for the first time. | ||||
| func _ready() -> void: | ||||
| 	(get_parent() as SubViewport).size = get_tree().get_root().get_viewport().size; | ||||
| 	get_tree().get_root().size_changed.connect(resize) | ||||
| 	 | ||||
| 
 | ||||
| 
 | ||||
| func resize() -> void: | ||||
| 	print("changed") | ||||
| 	print(get_tree().get_root().get_viewport().size) | ||||
| 	(get_parent() as SubViewport).size = get_tree().get_root().get_viewport().size; | ||||
		Loading…
	
	Add table
		
		Reference in a new issue