diff options
Diffstat (limited to 'addons/crt_shader/crt_screen.gd')
-rw-r--r-- | addons/crt_shader/crt_screen.gd | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/addons/crt_shader/crt_screen.gd b/addons/crt_shader/crt_screen.gd new file mode 100644 index 0000000..5674626 --- /dev/null +++ b/addons/crt_shader/crt_screen.gd @@ -0,0 +1,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) |