This commit is contained in:
Page Asgardius 2024-09-25 17:43:45 -07:00
parent b1e1a6202e
commit 672a09d32e
8 changed files with 201 additions and 5 deletions

View file

@ -53,7 +53,7 @@ func _on_sound_test_pressed():
func _on_back_pressed():
Global.debug = false
get_tree().change_scene_to_file("res://levels/ui/tmenu.tscn")
get_tree().change_scene_to_file("res://levels/ui/settings.tscn")
func _on_gamepad_test_pressed():

91
levels/ui/settings.gd Normal file
View file

@ -0,0 +1,91 @@
extends Control
const gamepadtest = preload("res://gamepad.gd")
var vsync
var fullscreen
var xw
var gldrv
func _ready():
vsync = $VBoxContainer/L20
fullscreen = $VBoxContainer/Lilytest
xw = $VBoxContainer/Dialogtest
gldrv = $VBoxContainer/Bullethell
#Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
$VBoxContainer/L20.grab_focus()
if DisplayServer.window_get_vsync_mode() == 1:
vsync.set_text(tr("SETTING_VSYNCT"))
else:
vsync.set_text(tr("SETTING_VSYNCF"))
if DisplayServer.window_get_mode() == 3:
fullscreen.set_text(tr("SETTING_FULLSCREEN"))
else:
fullscreen.set_text(tr("SETTING_WINDOWED"))
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _level():
# This is like autoloading the scene, only
# it happens after already loading the main scene.
get_tree().change_scene_to_file("res://backgounds/disclaimer.tscn")
#Global.live = 1
#Global.gamelevel = randi() % 3
#if Global.gamelevel == 0:
# get_tree().change_scene_to_file("res://backgounds/galaxy.tscn")
#elif Global.gamelevel == 1:
# get_tree().change_scene_to_file("res://backgounds/wormhole.tscn")
#else:
# get_tree().change_scene_to_file("res://backgounds/abstract.tscn")
#get_tree().root.add_child(title)
#get_tree().root.remove_child(boot)
#boot.queue_free()
func _input(event):
gamepadtest.new(event)
# Mouse in viewport coordinates.
if Input.is_action_just_pressed("ui_cancel"):
_on_back_pressed()
#print("Mouse Click/Unclick at: ", event.position)
# if highlighted == 1:
# _on_debug_pressed()
# if highlighted == 2:
# _on_exit_pressed()
# else:
# _on_start_pressed()
# elif Input.is_action_pressed("ui_up"):
# focus_next
func _on_back_pressed():
get_tree().change_scene_to_file("res://levels/ui/tmenu.tscn")
func _on_l_20_pressed():
if DisplayServer.window_get_vsync_mode() == 1:
DisplayServer.window_set_vsync_mode(0)
vsync.set_text(tr("SETTING_VSYNCF"))
else:
DisplayServer.window_set_vsync_mode(1)
vsync.set_text(tr("SETTING_VSYNCT"))
func _on_lilytest_pressed() -> void:
if DisplayServer.window_get_mode() == 3:
DisplayServer.window_set_mode(0)
fullscreen.set_text(tr("SETTING_WINDOWED"))
else:
DisplayServer.window_set_mode(3)
fullscreen.set_text(tr("SETTING_FULLSCREEN"))
func _on_dialogtest_pressed() -> void:
get_tree().change_scene_to_file("res://levels/ui/debug.tscn")
func _on_bullethell_pressed() -> void:
pass

100
levels/ui/settings.tscn Normal file
View file

@ -0,0 +1,100 @@
[gd_scene load_steps=6 format=3 uid="uid://c30jrya5fjras"]
[ext_resource type="Script" path="res://levels/ui/settings.gd" id="1_7pd0a"]
[ext_resource type="Texture2D" uid="uid://bxa27c7gnivwx" path="res://backgounds/night-sky-at-ceres.jpg" id="2_pw0o8"]
[ext_resource type="PackedScene" uid="uid://d31udhuuwrajn" path="res://levels/bottomhud.tscn" id="3_4donf"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_6u0xs"]
bg_color = Color(0, 0.8, 0, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_r2qrn"]
bg_color = Color(0, 0.8, 0, 1)
[node name="Settings" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_7pd0a")
[node name="Night Sky" type="TextureRect" parent="."]
layout_mode = 0
offset_right = 1280.0
offset_bottom = 720.0
texture = ExtResource("2_pw0o8")
[node name="Game name" type="Label" parent="."]
layout_mode = 0
offset_left = 35.0
offset_top = 3.0
offset_right = 1235.0
offset_bottom = 73.0
theme_override_font_sizes/font_size = 40
text = "BUTTON_SETTINGS"
horizontal_alignment = 1
[node name="Bottomhud" parent="." instance=ExtResource("3_4donf")]
layout_mode = 1
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -139.0
offset_top = -395.0
offset_right = 139.0
grow_horizontal = 2
grow_vertical = 0
[node name="L20" type="Button" parent="VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs")
text = "CERES_L20_DESC"
[node name="Lilytest" type="Button" parent="VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs")
text = "MENU_MAP"
[node name="Dialogtest" type="Button" parent="VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs")
text = "BUTTON_DEBUG"
[node name="Bullethell" type="Button" parent="VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs")
text = "BUTTON_PLACEHOLDER"
[node name="Credits" type="Button" parent="VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs")
text = "BUTTON_PLACEHOLDER"
[node name="WIP" type="Button" parent="VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs")
text = "BUTTON_PLACEHOLDER"
[node name="Back" type="Button" parent="VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
theme_override_styles/focus = SubResource("StyleBoxFlat_r2qrn")
text = "BUTTON_RETURN"
[connection signal="pressed" from="VBoxContainer/L20" to="." method="_on_l_20_pressed"]
[connection signal="pressed" from="VBoxContainer/Lilytest" to="." method="_on_lilytest_pressed"]
[connection signal="pressed" from="VBoxContainer/Dialogtest" to="." method="_on_dialogtest_pressed"]
[connection signal="pressed" from="VBoxContainer/Bullethell" to="." method="_on_bullethell_pressed"]
[connection signal="pressed" from="VBoxContainer/Back" to="." method="_on_back_pressed"]

View file

@ -56,7 +56,7 @@ func _on_start_pressed():
func _on_debug_pressed():
get_tree().change_scene_to_file("res://levels/ui/debug.tscn")
get_tree().change_scene_to_file("res://levels/ui/settings.tscn")
func _on_exit_pressed():

View file

@ -64,7 +64,7 @@ text = "BUTTON_START"
layout_mode = 2
theme_override_font_sizes/font_size = 80
theme_override_styles/focus = SubResource("StyleBoxFlat_6u0xs")
text = "BUTTON_DEBUG"
text = "BUTTON_SETTINGS"
[node name="Savefile" type="Button" parent="VBoxContainer"]
layout_mode = 2