summaryrefslogtreecommitdiff
path: root/addons/crt_shader/crt_screen.gd
blob: 56746264c902cf4e9ca7bb3000cb20a267a27a94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
@tool
extends ColorRect

const ShaderScreenMaterial: ShaderMaterial = preload("res://addons/crt_shader/ShaderScreen.material")


func _ready() -> void:
	if material == null:
		material = ShaderScreenMaterial
	
	item_rect_changed.connect(_update_screen_parameters)
	_update_screen_parameters()


func _update_screen_parameters():
	var shader_material : ShaderMaterial = material
	shader_material.set_shader_parameter("screen_width", size.x)
	shader_material.set_shader_parameter("screen_height", size.y)