extends Control

const MENU_SCENE := "res://scenes/menu.tscn"
const WS_URL := "ws://localhost:8081/ws"

@onready var back_button: Button = $UiLayer/BackButton
@onready var ws_url_label: Label = $UiLayer/Panel/WSUrlLabel
@onready var viewport_label: Label = $UiLayer/Panel/ViewportLabel


func _ready() -> void:
	back_button.pressed.connect(_return_to_menu)
	ws_url_label.text = "WebSocket: %s" % WS_URL
	var size := get_viewport_rect().size
	viewport_label.text = "Viewport: %d × %d" % [int(size.x), int(size.y)]


func _return_to_menu() -> void:
	get_tree().change_scene_to_file(MENU_SCENE)
