From 3a23030e2c20129f8671c94c5dcf7934f2d9b480 Mon Sep 17 00:00:00 2001 From: Terry Hearst Date: Sun, 18 Feb 2024 03:02:01 -0500 Subject: [PATCH] Fix/refactor menu and stretch mode --- project.godot | 2 +- src/menu.gd | 12 ++++++++---- src/menu.tscn | 2 ++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/project.godot b/project.godot index ed38094..1c39245 100644 --- a/project.godot +++ b/project.godot @@ -23,7 +23,7 @@ Global="*res://src/global.gd" window/size/viewport_width=640 window/size/viewport_height=960 -window/stretch/mode="2d" +window/stretch/mode="canvas_items" window/handheld/orientation="portrait" [gui] diff --git a/src/menu.gd b/src/menu.gd index daac3f8..02a5172 100644 --- a/src/menu.gd +++ b/src/menu.gd @@ -1,9 +1,13 @@ extends Control +@onready var quit_button: Button = %QuitButton +@onready var credits: ColorRect = %Credits + + func _ready() -> void: - if OS.get_name() == "HTML5": - $C/V/V2/QuitButton.hide() + if OS.has_feature("web"): + quit_button.hide() func _on_DailyButton_pressed() -> void: @@ -19,7 +23,7 @@ func _on_RandomButton_pressed() -> void: func _on_CreditsButton_pressed() -> void: - $Credits.show() + credits.show() func _on_QuitButton_pressed() -> void: @@ -27,4 +31,4 @@ func _on_QuitButton_pressed() -> void: func _on_CreditsBackButton_pressed() -> void: - $Credits.hide() + credits.hide() diff --git a/src/menu.tscn b/src/menu.tscn index 4bbe338..dd30b2d 100644 --- a/src/menu.tscn +++ b/src/menu.tscn @@ -123,10 +123,12 @@ layout_mode = 2 text = "Licenses" [node name="QuitButton" type="Button" parent="C/V/V2"] +unique_name_in_owner = true layout_mode = 2 text = "Quit" [node name="Credits" type="ColorRect" parent="."] +unique_name_in_owner = true visible = false layout_mode = 0 anchor_right = 1.0