]> Untitled Git - wolf-seeking-sheep.git/blob - addons/dialogic/Modules/Background/DefaultBackgroundScene/default_background.gd
Squashed commit of the following:
[wolf-seeking-sheep.git] / addons / dialogic / Modules / Background / DefaultBackgroundScene / default_background.gd
1 extends DialogicBackground
2
3 ## The default background scene.
4 ## Extend the DialogicBackground class to create your own background scene.
5
6 @onready var image_node: TextureRect = $Image
7 @onready var color_node: ColorRect = $ColorRect
8
9
10 func _ready() -> void:
11         image_node.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
12         image_node.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_COVERED
13
14         image_node.anchor_right = 1
15         image_node.anchor_bottom = 1
16
17
18 func _update_background(argument:String, _time:float) -> void:
19         if argument.begins_with('res://'):
20                 image_node.texture = load(argument)
21                 color_node.color = Color.TRANSPARENT
22         elif argument.is_valid_html_color():
23                 image_node.texture = null
24                 color_node.color = Color(argument, 1)
25         else:
26                 image_node.texture = null
27                 color_node.color = Color.from_string(argument, Color.TRANSPARENT)