extends CanvasLayer

#dynamic sizes for elements as proportion of screen height
@export var margin_spacing : float = (1.0/25.0)
@export var size_text_heading : float = (1.0/8.0)
@export var size_text_prompt_selected : float = (1.0/12.0)
@export var interact_icon_size : float = (128.0/720.0)

func _ready() -> void:
	set_proportions()
	get_viewport().size_changed.connect(set_proportions)
	$icon_eye.self_modulate.a = 0.3
	$icon_hand.self_modulate.a = 0.3
	pass

func _process(delta: float) -> void:
	pass
	
# adjust UI element sizes to be proportionate to window height
func set_proportions():
	var screenwidth : float = get_viewport().size.x
	var screenheight : float = get_viewport().size.y
	$hud_top.add_theme_constant_override("margin_top", int(screenheight * margin_spacing))
	$hud_top/center/testtext.label_settings.set_font_size(int(screenheight * size_text_heading))
	$hud_bottom.add_theme_constant_override("margin_bottom", int(screenheight * margin_spacing))
	$icon_eye.set_size(Vector2(int(screenheight * interact_icon_size), int(screenheight * interact_icon_size)))
	$icon_hand.set_size(Vector2(int(screenheight * interact_icon_size), int(screenheight * interact_icon_size)))
	$hud_bottom/promptbox/prompt_primary.label_settings.set_font_size(int(screenheight * size_text_prompt_selected))
