⚗️ HUD updates

This commit is contained in:
schorsch_huckleberry 2024-04-20 19:40:23 +00:00 committed by anyreso
parent 80831ac65f
commit e5074e3174
13 changed files with 491 additions and 282 deletions

View file

@ -1,7 +1,7 @@
[gd_scene load_steps=7 format=3 uid="uid://c88l3h0ph00c7"]
[ext_resource type="Script" path="res://entities/flag/flag.gd" id="1_y7d3d"]
[ext_resource type="PackedScene" uid="uid://dqrx87qbea1pr" path="res://entities/flag/assets/flag.glb" id="2_i78em"]
[ext_resource type="PackedScene" path="res://entities/flag/assets/flag.glb" id="2_i78em"]
[ext_resource type="PackedScene" uid="uid://bcgkc5fhhyauv" path="res://entities/flag/waypoint.tscn" id="3_tu6jg"]
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_4ymrw"]

View file

@ -8,7 +8,7 @@
[ext_resource type="PackedScene" uid="uid://dn1tcakam5egs" path="res://entities/weapons/space_gun/projectile.tscn" id="5_2xh36"]
[ext_resource type="PackedScene" uid="uid://bof3mg7wgxrmn" path="res://components/health_component.tscn" id="5_t6i6e"]
[ext_resource type="Script" path="res://entities/player/player_input.gd" id="6_ymcrr"]
[ext_resource type="PackedScene" uid="uid://dsysi2rd3bu76" path="res://interfaces/hud/iff.tscn" id="7_8hc80"]
[ext_resource type="PackedScene" uid="uid://dsysi2rd3bu76" path="res://interfaces/hud/iffs/iff.tscn" id="7_8hc80"]
[ext_resource type="PackedScene" uid="uid://2t8ql8pkxv6c" path="res://components/flag_carry_component.tscn" id="7_e7s1a"]
[ext_resource type="Script" path="res://addons/smoothing/smoothing.gd" id="11_k330l"]

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 KiB

View file

@ -1,4 +0,0 @@
[gd_resource type="StyleBoxFlat" format=3 uid="uid://cl7dmo2bg4153"]
[resource]
bg_color = Color(1, 0.356863, 0.145098, 1)

View file

@ -1,13 +1,14 @@
[gd_scene load_steps=6 format=3 uid="uid://bcv81ku26xo"]
[gd_scene load_steps=8 format=3 uid="uid://bcv81ku26xo"]
[ext_resource type="StyleBox" uid="uid://cl7dmo2bg4153" path="res://interfaces/hud/healthbar_fill_style.tres" id="1_gh51l"]
[ext_resource type="StyleBox" uid="uid://dcn1ll2ra4lwn" path="res://interfaces/hud/vitals/background.tres" id="1_gmv44"]
[ext_resource type="StyleBox" uid="uid://bq7rjpm38pao7" path="res://interfaces/hud/vitals/health_foreground.tres" id="2_6ejsl"]
[sub_resource type="GDScript" id="GDScript_2vxif"]
script/source = "extends CanvasLayer
class_name HUD
script/source = "class_name HUD extends CanvasLayer
@onready var _health_bar : ProgressBar = $HealthBar
@onready var _energy_bar : ProgressBar = $EnergyBar
@export_category(\"Vitals\")
@export var _health_bar : ProgressBar
@export var _energy_bar : ProgressBar
func _ready() -> void:
_update_health_bar(100.)
@ -26,11 +27,6 @@ func _on_health_changed(new_health : float) -> void:
_update_health_bar(new_health)
"
[sub_resource type="Theme" id="Theme_irfqb"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_f23s3"]
bg_color = Color(0, 0.454902, 0.992157, 1)
[sub_resource type="GDScript" id="GDScript_w8l21"]
script/source = "extends Label
@ -38,7 +34,8 @@ script/source = "extends Label
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
if not OS.is_debug_build():
queue_free()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta : float) -> void:
@ -48,76 +45,101 @@ func _process(_delta : float) -> void:
text += \"speed: %d km/h\\n\" % (player.linear_velocity.length() * 3.6)
"
[node name="HUD" type="CanvasLayer"]
[sub_resource type="Shader" id="Shader_gaah5"]
code = "shader_type canvas_item;
uniform vec4 color : source_color;
float circle(vec2 pos, float radius, float feather) {
return smoothstep(radius, radius - feather, length(pos - vec2(.5)));
}
void fragment() {
// draw reticle
float alpha = circle(UV, .5, .04);
COLOR = vec4(color.rgb, alpha);
}"
[sub_resource type="ShaderMaterial" id="ShaderMaterial_7blp5"]
shader = SubResource("Shader_gaah5")
shader_parameter/color = Color(1, 1, 1, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_f23s3"]
bg_color = Color(0.0901961, 0.87451, 0.760784, 0.65098)
corner_radius_top_left = 3
corner_radius_top_right = 3
corner_radius_bottom_right = 3
corner_radius_bottom_left = 3
anti_aliasing = false
[node name="HUD" type="CanvasLayer" node_paths=PackedStringArray("_health_bar", "_energy_bar")]
script = SubResource("GDScript_2vxif")
[node name="HealthBar" type="ProgressBar" parent="."]
offset_left = 32.0
offset_top = 32.0
offset_right = 288.0
offset_bottom = 40.0
size_flags_horizontal = 0
mouse_filter = 2
theme_override_styles/fill = ExtResource("1_gh51l")
value = 60.0
show_percentage = false
[node name="EnergyBar" type="ProgressBar" parent="."]
offset_left = 32.0
offset_top = 48.0
offset_right = 288.0
offset_bottom = 56.0
size_flags_horizontal = 0
mouse_filter = 2
theme = SubResource("Theme_irfqb")
theme_override_styles/fill = SubResource("StyleBoxFlat_f23s3")
value = 60.0
show_percentage = false
_health_bar = NodePath("MarginContainer/HBoxContainer/VBoxContainer/HealthBar")
_energy_bar = NodePath("MarginContainer/HBoxContainer/VBoxContainer/EnergyBar")
[node name="DebugLabel" type="Label" parent="."]
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_left = 20.0
offset_top = -33.0
offset_top = 20.0
offset_right = 21.0
offset_bottom = -10.0
grow_vertical = 0
offset_bottom = 43.0
script = SubResource("GDScript_w8l21")
[node name="Reticle" type="Control" parent="."]
layout_mode = 3
[node name="Reticle" type="ColorRect" parent="."]
material = SubResource("ShaderMaterial_7blp5")
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -20.0
offset_top = -20.0
offset_right = 20.0
offset_bottom = 20.0
offset_left = -1.5
offset_top = -1.5
offset_right = 1.5
offset_bottom = 1.5
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
[node name="LineBottom" type="Line2D" parent="Reticle"]
position = Vector2(13, 4)
points = PackedVector2Array(7, 19, 7, 31)
width = 2.0
[node name="MarginContainer" type="MarginContainer" parent="."]
anchors_preset = 12
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -42.0
grow_horizontal = 2
grow_vertical = 0
theme_override_constants/margin_left = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 20
[node name="LineLeft" type="Line2D" parent="Reticle"]
position = Vector2(36, 13)
rotation = 1.5708
points = PackedVector2Array(7, 19, 7, 31)
width = 2.0
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="LineTop" type="Line2D" parent="Reticle"]
position = Vector2(13, -14)
points = PackedVector2Array(7, 19, 7, 31)
width = 2.0
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 0.2
theme_override_constants/separation = 6
[node name="LineRight" type="Line2D" parent="Reticle"]
position = Vector2(54, 13)
rotation = 1.5708
points = PackedVector2Array(7, 19, 7, 31)
width = 2.0
[node name="HealthBar" type="ProgressBar" parent="MarginContainer/HBoxContainer/VBoxContainer"]
custom_minimum_size = Vector2(0, 8)
layout_mode = 2
mouse_filter = 2
theme_override_styles/background = ExtResource("1_gmv44")
theme_override_styles/fill = ExtResource("2_6ejsl")
value = 60.0
show_percentage = false
[node name="EnergyBar" type="ProgressBar" parent="MarginContainer/HBoxContainer/VBoxContainer"]
custom_minimum_size = Vector2(0, 8)
layout_mode = 2
mouse_filter = 2
theme_override_styles/background = ExtResource("1_gmv44")
theme_override_styles/fill = SubResource("StyleBoxFlat_f23s3")
value = 60.0
show_percentage = false
[node name="Spacer" type="Control" parent="MarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 0.8

View file

@ -1,12 +1,13 @@
[gd_scene load_steps=3 format=3 uid="uid://dsysi2rd3bu76"]
[gd_scene load_steps=4 format=3 uid="uid://dsysi2rd3bu76"]
[ext_resource type="Script" path="res://interfaces/hud/iff.gd" id="1_75yi1"]
[ext_resource type="StyleBox" uid="uid://cgv081wfih7la" path="res://interfaces/hud/iff_healthbar_fill_style.tres" id="2_frxvy"]
[ext_resource type="Script" path="res://interfaces/hud/iffs/iff.gd" id="1_g1wra"]
[ext_resource type="StyleBox" uid="uid://cgv081wfih7la" path="res://interfaces/hud/iffs/health_foreground.tres" id="2_e3xla"]
[ext_resource type="StyleBox" uid="uid://dcn1ll2ra4lwn" path="res://interfaces/hud/vitals/background.tres" id="2_jtos4"]
[node name="IFF" type="Control"]
layout_mode = 3
anchors_preset = 0
script = ExtResource("1_75yi1")
script = ExtResource("1_g1wra")
[node name="IFFContainer" type="MarginContainer" parent="."]
layout_mode = 0
@ -34,7 +35,8 @@ offset_top = 20.0
offset_right = 63.0
offset_bottom = 24.0
mouse_filter = 2
theme_override_styles/fill = ExtResource("2_frxvy")
theme_override_styles/background = ExtResource("2_jtos4")
theme_override_styles/fill = ExtResource("2_e3xla")
value = 60.0
show_percentage = false

View file

@ -0,0 +1,9 @@
[gd_resource type="StyleBoxFlat" format=3 uid="uid://dcn1ll2ra4lwn"]
[resource]
bg_color = Color(0, 0, 0, 0.25)
corner_radius_top_left = 3
corner_radius_top_right = 3
corner_radius_bottom_right = 3
corner_radius_bottom_left = 3
anti_aliasing = false

View file

@ -0,0 +1,10 @@
[gd_resource type="StyleBoxFlat" format=3 uid="uid://bq7rjpm38pao7"]
[resource]
resource_local_to_scene = true
bg_color = Color(0.025, 0.75, 0.1, 0.65)
corner_radius_top_left = 3
corner_radius_top_right = 3
corner_radius_bottom_right = 3
corner_radius_bottom_left = 3
anti_aliasing = false

View file

@ -1,7 +1,6 @@
[gd_scene load_steps=7 format=3 uid="uid://bjctlqvs33nqy"]
[gd_scene load_steps=9 format=3 uid="uid://bjctlqvs33nqy"]
[ext_resource type="Texture2D" uid="uid://c1tjamjm8qjog" path="res://interfaces/menus/boot/background.webp" id="1_ph586"]
[ext_resource type="PackedScene" uid="uid://dirxn4o0g48ng" path="res://interfaces/menus/boot/settings.tscn" id="2_0ncey"]
[sub_resource type="GDScript" id="GDScript_jd8xf"]
resource_name = "MainMenu"
@ -9,9 +8,6 @@ script/source = "class_name BootMenu extends CanvasLayer
signal start_demo
func _ready() -> void:
$Settings.menu_pressed.connect(_on_menu_pressed)
func _on_demo_pressed() -> void:
start_demo.emit()
@ -24,19 +20,20 @@ func _on_settings_pressed() -> void:
func _on_quit_pressed() -> void:
get_tree().quit()
func _on_menu_pressed() -> void:
func _on_main_menu_pressed() -> void:
_show_menu($Main)
func _show_menu(menu : PanelContainer) -> void:
$Main.hide()
$Multiplayer.hide()
$Multiplayer.tab_container.current_tab = 0
$Settings.hide()
$Settings.tab_container.current_tab = 0
$Main.hide()
menu.show()
"
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_krqeq"]
bg_color = Color(0.5, 0.5, 0.5, 0.25)
bg_color = Color(0.501961, 0.501961, 0.501961, 0.25098)
[sub_resource type="GDScript" id="GDScript_tc1bm"]
script/source = "class_name Multiplayer extends PanelContainer
@ -54,6 +51,7 @@ signal join_server(host : String, port : int)
@onready var modal : Control = $Modal
@onready var menu : CanvasLayer = get_parent()
@export var tab_container : TabContainer
func _ready() -> void:
# see https://datatracker.ietf.org/doc/html/rfc1700
@ -114,8 +112,39 @@ func _on_connection_failed() -> void:
$Modal.hide()
"
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_snh7i"]
bg_color = Color(0, 0.5, 0.5, 0.25)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ky5sv"]
bg_color = Color(0.5, 0.5, 0.5, 0.25)
[sub_resource type="GDScript" id="GDScript_gbnwv"]
resource_name = "Settings"
script/source = "extends PanelContainer
const WINDOW_MODE_OPTIONS = [DisplayServer.WINDOW_MODE_WINDOWED, DisplayServer.WINDOW_MODE_FULLSCREEN]
@onready var _game_settings : Settings = get_node(\"/root/GlobalSettings\")
@export var tab_container : TabContainer
func _ready() -> void:
%FOVSpinBox.value = _game_settings.fov
%SensitivitySpinBox.value = _game_settings.mouse_sensitivity
var window_mode : int = 1 if _game_settings.fullscreen else 0
%InvertedYCheckbox.button_pressed = _game_settings.inverted_y_axis
%WindowModeOptionButton.select(window_mode)
func _on_save_pressed() -> void:
_game_settings.fov = %FOVSpinBox.value
_game_settings.mouse_sensitivity = %SensitivitySpinBox.value
_game_settings.inverted_y_axis = %InvertedYCheckbox.button_pressed
_game_settings.fullscreen = %WindowModeOptionButton.selected == 1
_game_settings.save_to_file()
"
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_c4ymk"]
bg_color = Color(0, 0, 0, 0)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_dq4me"]
bg_color = Color(0, 0.5, 0.5, 0.2)
[node name="BootMenu" type="CanvasLayer"]
script = SubResource("GDScript_jd8xf")
@ -130,7 +159,7 @@ mouse_filter = 2
texture = ExtResource("1_ph586")
stretch_mode = 6
[node name="Multiplayer" type="PanelContainer" parent="."]
[node name="Multiplayer" type="PanelContainer" parent="." node_paths=PackedStringArray("tab_container")]
visible = false
anchors_preset = 15
anchor_right = 1.0
@ -139,6 +168,7 @@ grow_horizontal = 2
grow_vertical = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_krqeq")
script = SubResource("GDScript_tc1bm")
tab_container = NodePath("MarginContainer/VBoxContainer/TabContainer")
[node name="MarginContainer" type="MarginContainer" parent="Multiplayer"]
layout_mode = 2
@ -172,25 +202,56 @@ theme_override_constants/margin_bottom = 20
layout_mode = 2
theme_override_constants/separation = 20
[node name="LeftBox" type="VBoxContainer" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Profile/MarginContainer/HBoxContainer"]
[node name="LeftBox" type="Control" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Profile/MarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 0.25
[node name="Create" type="Button" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Profile/MarginContainer/HBoxContainer/LeftBox"]
[node name="Top" type="VBoxContainer" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Profile/MarginContainer/HBoxContainer/LeftBox"]
layout_mode = 1
anchors_preset = 10
anchor_right = 1.0
offset_bottom = 101.0
grow_horizontal = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 0.25
[node name="Create" type="Button" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Profile/MarginContainer/HBoxContainer/LeftBox/Top"]
layout_mode = 2
disabled = true
text = "Create"
[node name="Delete" type="Button" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Profile/MarginContainer/HBoxContainer/LeftBox"]
[node name="Delete" type="Button" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Profile/MarginContainer/HBoxContainer/LeftBox/Top"]
layout_mode = 2
disabled = true
text = "Delete"
[node name="Save" type="Button" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Profile/MarginContainer/HBoxContainer/LeftBox"]
[node name="Save" type="Button" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Profile/MarginContainer/HBoxContainer/LeftBox/Top"]
layout_mode = 2
text = "Save"
[node name="Bottom" type="VBoxContainer" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Profile/MarginContainer/HBoxContainer/LeftBox"]
layout_mode = 1
anchors_preset = 12
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -31.0
grow_horizontal = 2
grow_vertical = 0
size_flags_horizontal = 0
[node name="MainMenu" type="Button" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Profile/MarginContainer/HBoxContainer/LeftBox/Bottom"]
layout_mode = 2
size_flags_horizontal = 3
text = "Main Menu
"
[node name="Quit" type="Button" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Profile/MarginContainer/HBoxContainer/LeftBox/Bottom"]
layout_mode = 2
size_flags_horizontal = 3
text = "Quit"
[node name="RightBox" type="VBoxContainer" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Profile/MarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
@ -226,15 +287,46 @@ theme_override_constants/margin_bottom = 20
layout_mode = 2
theme_override_constants/separation = 10
[node name="LeftBox" type="VBoxContainer" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Join/MarginContainer/HBoxContainer"]
[node name="LeftBox" type="Control" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Join/MarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 0.25
[node name="Join" type="Button" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Join/MarginContainer/HBoxContainer/LeftBox"]
[node name="Top" type="VBoxContainer" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Join/MarginContainer/HBoxContainer/LeftBox"]
layout_mode = 1
anchors_preset = 10
anchor_right = 1.0
offset_bottom = 101.0
grow_horizontal = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 0.25
[node name="Join" type="Button" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Join/MarginContainer/HBoxContainer/LeftBox/Top"]
layout_mode = 2
text = "Join"
[node name="Bottom" type="VBoxContainer" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Join/MarginContainer/HBoxContainer/LeftBox"]
layout_mode = 1
anchors_preset = 12
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -31.0
grow_horizontal = 2
grow_vertical = 0
size_flags_horizontal = 0
[node name="MainMenu" type="Button" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Join/MarginContainer/HBoxContainer/LeftBox/Bottom"]
layout_mode = 2
size_flags_horizontal = 3
text = "Main Menu
"
[node name="Quit" type="Button" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Join/MarginContainer/HBoxContainer/LeftBox/Bottom"]
layout_mode = 2
size_flags_horizontal = 3
text = "Quit"
[node name="RightBox" type="VBoxContainer" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Join/MarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
@ -265,15 +357,46 @@ theme_override_constants/margin_bottom = 20
layout_mode = 2
theme_override_constants/separation = 10
[node name="LeftBox" type="VBoxContainer" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Host/MarginContainer/HBoxContainer"]
[node name="LeftBox" type="Control" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Host/MarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 0.25
[node name="Host" type="Button" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Host/MarginContainer/HBoxContainer/LeftBox"]
[node name="Top" type="VBoxContainer" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Host/MarginContainer/HBoxContainer/LeftBox"]
layout_mode = 1
anchors_preset = 10
anchor_right = 1.0
offset_bottom = 101.0
grow_horizontal = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 0.25
[node name="Host" type="Button" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Host/MarginContainer/HBoxContainer/LeftBox/Top"]
layout_mode = 2
text = "Host"
[node name="Bottom" type="VBoxContainer" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Host/MarginContainer/HBoxContainer/LeftBox"]
layout_mode = 1
anchors_preset = 12
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -66.0
grow_horizontal = 2
grow_vertical = 0
size_flags_horizontal = 0
[node name="MainMenu" type="Button" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Host/MarginContainer/HBoxContainer/LeftBox/Bottom"]
layout_mode = 2
size_flags_horizontal = 3
text = "Main Menu
"
[node name="Quit" type="Button" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Host/MarginContainer/HBoxContainer/LeftBox/Bottom"]
layout_mode = 2
size_flags_horizontal = 3
text = "Quit"
[node name="RightBox" type="VBoxContainer" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Host/MarginContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
@ -283,15 +406,6 @@ unique_name_in_owner = true
layout_mode = 2
placeholder_text = "9000"
[node name="VBoxContainer" type="HBoxContainer" parent="Multiplayer/MarginContainer/VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 0
[node name="Menu" type="Button" parent="Multiplayer/MarginContainer/VBoxContainer/VBoxContainer"]
layout_mode = 2
text = "Back to Main Menu
"
[node name="Modal" type="Panel" parent="Multiplayer"]
visible = false
layout_mode = 2
@ -311,55 +425,262 @@ grow_horizontal = 2
grow_vertical = 2
text = "CONNECTING..."
[node name="Settings" parent="." instance=ExtResource("2_0ncey")]
[node name="Settings" type="PanelContainer" parent="." node_paths=PackedStringArray("tab_container")]
visible = false
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_ky5sv")
script = SubResource("GDScript_gbnwv")
tab_container = NodePath("MarginContainer/VBoxContainer/TabContainer")
[node name="MarginContainer" type="MarginContainer" parent="Settings"]
layout_mode = 2
theme_override_constants/margin_left = 20
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 20
[node name="VBoxContainer" type="VBoxContainer" parent="Settings/MarginContainer"]
layout_mode = 2
[node name="TabContainer" type="TabContainer" parent="Settings/MarginContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
theme_override_constants/side_margin = 0
[node name="Gameplay" type="TabBar" parent="Settings/MarginContainer/VBoxContainer/TabContainer"]
layout_mode = 2
theme_override_constants/h_separation = 0
[node name="MarginContainer" type="MarginContainer" parent="Settings/MarginContainer/VBoxContainer/TabContainer/Gameplay"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 20
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 20
[node name="GridContainer" type="GridContainer" parent="Settings/MarginContainer/VBoxContainer/TabContainer/Gameplay/MarginContainer"]
layout_mode = 2
columns = 2
[node name="FOVLabel" type="Label" parent="Settings/MarginContainer/VBoxContainer/TabContainer/Gameplay/MarginContainer/GridContainer"]
layout_mode = 2
text = "Field of view"
[node name="FOVSpinBox" type="SpinBox" parent="Settings/MarginContainer/VBoxContainer/TabContainer/Gameplay/MarginContainer/GridContainer"]
unique_name_in_owner = true
layout_mode = 2
min_value = 60.0
max_value = 120.0
value = 60.0
[node name="SensitivityLabel" type="Label" parent="Settings/MarginContainer/VBoxContainer/TabContainer/Gameplay/MarginContainer/GridContainer"]
layout_mode = 2
text = "Mouse sensitivity"
[node name="SensitivitySpinBox" type="SpinBox" parent="Settings/MarginContainer/VBoxContainer/TabContainer/Gameplay/MarginContainer/GridContainer"]
unique_name_in_owner = true
layout_mode = 2
max_value = 1.0
step = 0.01
value = 1.0
[node name="InvertedYLabel" type="Label" parent="Settings/MarginContainer/VBoxContainer/TabContainer/Gameplay/MarginContainer/GridContainer"]
layout_mode = 2
text = "Inverted Y"
[node name="InvertedYCheckbox" type="CheckBox" parent="Settings/MarginContainer/VBoxContainer/TabContainer/Gameplay/MarginContainer/GridContainer"]
unique_name_in_owner = true
layout_mode = 2
[node name="Buttons" type="HBoxContainer" parent="Settings/MarginContainer/VBoxContainer/TabContainer/Gameplay/MarginContainer"]
layout_mode = 2
size_flags_vertical = 8
[node name="Bottom" type="VBoxContainer" parent="Settings/MarginContainer/VBoxContainer/TabContainer/Gameplay/MarginContainer/Buttons"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 0.2
[node name="Save" type="Button" parent="Settings/MarginContainer/VBoxContainer/TabContainer/Gameplay/MarginContainer/Buttons/Bottom"]
layout_mode = 2
text = "Save
"
[node name="MainMenu" type="Button" parent="Settings/MarginContainer/VBoxContainer/TabContainer/Gameplay/MarginContainer/Buttons/Bottom"]
layout_mode = 2
size_flags_horizontal = 3
text = "Main Menu
"
[node name="Quit" type="Button" parent="Settings/MarginContainer/VBoxContainer/TabContainer/Gameplay/MarginContainer/Buttons/Bottom"]
layout_mode = 2
size_flags_horizontal = 3
text = "Quit"
[node name="Spacer" type="Control" parent="Settings/MarginContainer/VBoxContainer/TabContainer/Gameplay/MarginContainer/Buttons"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 0.8
[node name="Graphics" type="TabBar" parent="Settings/MarginContainer/VBoxContainer/TabContainer"]
visible = false
layout_mode = 2
select_with_rmb = true
[node name="MarginContainer" type="MarginContainer" parent="Settings/MarginContainer/VBoxContainer/TabContainer/Graphics"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 20
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 20
[node name="GridContainer" type="GridContainer" parent="Settings/MarginContainer/VBoxContainer/TabContainer/Graphics/MarginContainer"]
layout_mode = 2
columns = 2
[node name="WindowModeLabel" type="Label" parent="Settings/MarginContainer/VBoxContainer/TabContainer/Graphics/MarginContainer/GridContainer"]
layout_mode = 2
text = "Window mode"
[node name="WindowModeOptionButton" type="OptionButton" parent="Settings/MarginContainer/VBoxContainer/TabContainer/Graphics/MarginContainer/GridContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
item_count = 2
selected = 0
popup/item_0/text = "Windowed"
popup/item_0/id = 0
popup/item_1/text = "Fullscreen"
popup/item_1/id = 1
[node name="Buttons" type="HBoxContainer" parent="Settings/MarginContainer/VBoxContainer/TabContainer/Graphics/MarginContainer"]
layout_mode = 2
size_flags_vertical = 8
[node name="Bottom" type="VBoxContainer" parent="Settings/MarginContainer/VBoxContainer/TabContainer/Graphics/MarginContainer/Buttons"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 0.2
[node name="Save" type="Button" parent="Settings/MarginContainer/VBoxContainer/TabContainer/Graphics/MarginContainer/Buttons/Bottom"]
layout_mode = 2
text = "Save
"
[node name="MainMenu" type="Button" parent="Settings/MarginContainer/VBoxContainer/TabContainer/Graphics/MarginContainer/Buttons/Bottom"]
layout_mode = 2
size_flags_horizontal = 3
text = "Main Menu
"
[node name="Quit" type="Button" parent="Settings/MarginContainer/VBoxContainer/TabContainer/Graphics/MarginContainer/Buttons/Bottom"]
layout_mode = 2
size_flags_horizontal = 3
text = "Quit"
[node name="Spacer" type="Control" parent="Settings/MarginContainer/VBoxContainer/TabContainer/Graphics/MarginContainer/Buttons"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 0.8
[node name="RemoveMe" type="HBoxContainer" parent="Settings/MarginContainer/VBoxContainer"]
visible = false
layout_mode = 2
size_flags_horizontal = 0
[node name="Menu" type="Button" parent="Settings/MarginContainer/VBoxContainer/RemoveMe"]
layout_mode = 2
text = "Back to Main Menu
"
[node name="Main" type="PanelContainer" parent="."]
anchors_preset = 9
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_right = 313.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 0
theme_override_styles/panel = SubResource("StyleBoxFlat_snh7i")
theme_override_styles/panel = SubResource("StyleBoxFlat_c4ymk")
[node name="MarginContainer" type="MarginContainer" parent="Main"]
[node name="HBoxContainer" type="HBoxContainer" parent="Main"]
layout_mode = 2
[node name="PanelContainer" type="PanelContainer" parent="Main/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 0.3
theme_override_styles/panel = SubResource("StyleBoxFlat_dq4me")
[node name="MarginContainer" type="MarginContainer" parent="Main/HBoxContainer/PanelContainer"]
layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/margin_left = 20
theme_override_constants/margin_right = 20
[node name="VBoxContainer" type="VBoxContainer" parent="Main/MarginContainer"]
[node name="VBoxContainer" type="VBoxContainer" parent="Main/HBoxContainer/PanelContainer/MarginContainer"]
layout_mode = 2
theme_override_constants/separation = 10
alignment = 1
[node name="Demo" type="Button" parent="Main/MarginContainer/VBoxContainer"]
[node name="Demo" type="Button" parent="Main/HBoxContainer/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
text = "Demo"
[node name="Multiplayer" type="Button" parent="Main/MarginContainer/VBoxContainer"]
[node name="Multiplayer" type="Button" parent="Main/HBoxContainer/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
text = "Multiplayer"
[node name="Settings" type="Button" parent="Main/MarginContainer/VBoxContainer"]
[node name="Settings" type="Button" parent="Main/HBoxContainer/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
text = "Settings"
[node name="Quit" type="Button" parent="Main/MarginContainer/VBoxContainer"]
[node name="Quit" type="Button" parent="Main/HBoxContainer/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
text = "Quit"
[node name="Control" type="Control" parent="Main/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 0.8
[connection signal="join_server" from="Multiplayer" to="." method="_on_multiplayer_join_server"]
[connection signal="start_server" from="Multiplayer" to="." method="_on_multiplayer_start_server"]
[connection signal="pressed" from="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Profile/MarginContainer/HBoxContainer/LeftBox/Save" to="Multiplayer" method="_on_save_pressed"]
[connection signal="pressed" from="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Join/MarginContainer/HBoxContainer/LeftBox/Join" to="Multiplayer" method="_on_join_pressed"]
[connection signal="pressed" from="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Host/MarginContainer/HBoxContainer/LeftBox/Host" to="Multiplayer" method="_on_host_pressed"]
[connection signal="pressed" from="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Profile/MarginContainer/HBoxContainer/LeftBox/Top/Save" to="Multiplayer" method="_on_save_pressed"]
[connection signal="pressed" from="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Profile/MarginContainer/HBoxContainer/LeftBox/Bottom/MainMenu" to="." method="_on_main_menu_pressed"]
[connection signal="pressed" from="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Profile/MarginContainer/HBoxContainer/LeftBox/Bottom/Quit" to="." method="_on_quit_pressed"]
[connection signal="pressed" from="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Join/MarginContainer/HBoxContainer/LeftBox/Top/Join" to="Multiplayer" method="_on_join_pressed"]
[connection signal="pressed" from="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Join/MarginContainer/HBoxContainer/LeftBox/Bottom/MainMenu" to="." method="_on_main_menu_pressed"]
[connection signal="pressed" from="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Join/MarginContainer/HBoxContainer/LeftBox/Bottom/Quit" to="." method="_on_quit_pressed"]
[connection signal="pressed" from="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Host/MarginContainer/HBoxContainer/LeftBox/Top/Host" to="Multiplayer" method="_on_host_pressed"]
[connection signal="pressed" from="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Host/MarginContainer/HBoxContainer/LeftBox/Bottom/MainMenu" to="." method="_on_main_menu_pressed"]
[connection signal="pressed" from="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Host/MarginContainer/HBoxContainer/LeftBox/Bottom/Quit" to="." method="_on_quit_pressed"]
[connection signal="text_changed" from="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Host/MarginContainer/HBoxContainer/RightBox/ServerPort" to="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Host/MarginContainer/HBoxContainer/RightBox/ServerPort" method="_on_text_changed"]
[connection signal="pressed" from="Multiplayer/MarginContainer/VBoxContainer/VBoxContainer/Menu" to="Multiplayer" method="_on_menu_pressed"]
[connection signal="pressed" from="Main/MarginContainer/VBoxContainer/Demo" to="." method="_on_demo_pressed"]
[connection signal="pressed" from="Main/MarginContainer/VBoxContainer/Multiplayer" to="." method="_on_multiplayer_pressed"]
[connection signal="pressed" from="Main/MarginContainer/VBoxContainer/Settings" to="." method="_on_settings_pressed"]
[connection signal="pressed" from="Main/MarginContainer/VBoxContainer/Quit" to="." method="_on_quit_pressed"]
[connection signal="pressed" from="Settings/MarginContainer/VBoxContainer/TabContainer/Gameplay/MarginContainer/Buttons/Bottom/Save" to="Settings" method="_on_save_pressed"]
[connection signal="pressed" from="Settings/MarginContainer/VBoxContainer/TabContainer/Gameplay/MarginContainer/Buttons/Bottom/MainMenu" to="." method="_on_main_menu_pressed"]
[connection signal="pressed" from="Settings/MarginContainer/VBoxContainer/TabContainer/Gameplay/MarginContainer/Buttons/Bottom/Quit" to="." method="_on_quit_pressed"]
[connection signal="pressed" from="Settings/MarginContainer/VBoxContainer/TabContainer/Graphics/MarginContainer/Buttons/Bottom/Save" to="Settings" method="_on_save_pressed"]
[connection signal="pressed" from="Settings/MarginContainer/VBoxContainer/TabContainer/Graphics/MarginContainer/Buttons/Bottom/MainMenu" to="." method="_on_main_menu_pressed"]
[connection signal="pressed" from="Settings/MarginContainer/VBoxContainer/TabContainer/Graphics/MarginContainer/Buttons/Bottom/Quit" to="." method="_on_quit_pressed"]
[connection signal="pressed" from="Settings/MarginContainer/VBoxContainer/RemoveMe/Menu" to="Settings" method="_on_menu_pressed"]
[connection signal="pressed" from="Main/HBoxContainer/PanelContainer/MarginContainer/VBoxContainer/Demo" to="." method="_on_demo_pressed"]
[connection signal="pressed" from="Main/HBoxContainer/PanelContainer/MarginContainer/VBoxContainer/Multiplayer" to="." method="_on_multiplayer_pressed"]
[connection signal="pressed" from="Main/HBoxContainer/PanelContainer/MarginContainer/VBoxContainer/Settings" to="." method="_on_settings_pressed"]
[connection signal="pressed" from="Main/HBoxContainer/PanelContainer/MarginContainer/VBoxContainer/Quit" to="." method="_on_quit_pressed"]

View file

@ -1,157 +0,0 @@
[gd_scene load_steps=3 format=3 uid="uid://dirxn4o0g48ng"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_krqeq"]
bg_color = Color(0.5, 0.5, 0.5, 0.25)
[sub_resource type="GDScript" id="GDScript_gbnwv"]
resource_name = "Settings"
script/source = "extends PanelContainer
const WINDOW_MODE_OPTIONS = [DisplayServer.WINDOW_MODE_WINDOWED, DisplayServer.WINDOW_MODE_FULLSCREEN]
@onready var _game_settings : Settings = get_node(\"/root/GlobalSettings\")
signal menu_pressed
func _ready() -> void:
%FOVSpinBox.value = _game_settings.fov
%SensitivitySpinBox.value = _game_settings.mouse_sensitivity
var window_mode : int = 1 if _game_settings.fullscreen else 0
%InvertedYCheckbox.button_pressed = _game_settings.inverted_y_axis
%WindowModeOptionButton.select(window_mode)
func _on_save_pressed() -> void:
_game_settings.fov = %FOVSpinBox.value
_game_settings.mouse_sensitivity = %SensitivitySpinBox.value
_game_settings.inverted_y_axis = %InvertedYCheckbox.button_pressed
_game_settings.fullscreen = %WindowModeOptionButton.selected == 1
_game_settings.save_to_file()
func _on_menu_pressed() -> void:
menu_pressed.emit()
"
[node name="Settings" type="PanelContainer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_styles/panel = SubResource("StyleBoxFlat_krqeq")
script = SubResource("GDScript_gbnwv")
[node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 2
theme_override_constants/margin_left = 20
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 20
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
layout_mode = 2
[node name="TabContainer" type="TabContainer" parent="MarginContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
theme_override_constants/side_margin = 0
[node name="Gameplay" type="TabBar" parent="MarginContainer/VBoxContainer/TabContainer"]
layout_mode = 2
theme_override_constants/h_separation = 0
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/VBoxContainer/TabContainer/Gameplay"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 20
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 20
[node name="GridContainer" type="GridContainer" parent="MarginContainer/VBoxContainer/TabContainer/Gameplay/MarginContainer"]
layout_mode = 2
columns = 2
[node name="FOVLabel" type="Label" parent="MarginContainer/VBoxContainer/TabContainer/Gameplay/MarginContainer/GridContainer"]
layout_mode = 2
text = "Field of view"
[node name="FOVSpinBox" type="SpinBox" parent="MarginContainer/VBoxContainer/TabContainer/Gameplay/MarginContainer/GridContainer"]
unique_name_in_owner = true
layout_mode = 2
min_value = 60.0
max_value = 120.0
value = 60.0
[node name="SensitivityLabel" type="Label" parent="MarginContainer/VBoxContainer/TabContainer/Gameplay/MarginContainer/GridContainer"]
layout_mode = 2
text = "Mouse sensitivity"
[node name="SensitivitySpinBox" type="SpinBox" parent="MarginContainer/VBoxContainer/TabContainer/Gameplay/MarginContainer/GridContainer"]
unique_name_in_owner = true
layout_mode = 2
max_value = 1.0
step = 0.01
value = 1.0
[node name="InvertedYLabel" type="Label" parent="MarginContainer/VBoxContainer/TabContainer/Gameplay/MarginContainer/GridContainer"]
layout_mode = 2
text = "Inverted Y"
[node name="InvertedYCheckbox" type="CheckBox" parent="MarginContainer/VBoxContainer/TabContainer/Gameplay/MarginContainer/GridContainer"]
unique_name_in_owner = true
layout_mode = 2
[node name="Graphics" type="TabBar" parent="MarginContainer/VBoxContainer/TabContainer"]
visible = false
layout_mode = 2
select_with_rmb = true
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/VBoxContainer/TabContainer/Graphics"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 20
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 20
[node name="GridContainer" type="GridContainer" parent="MarginContainer/VBoxContainer/TabContainer/Graphics/MarginContainer"]
layout_mode = 2
columns = 2
[node name="WindowModeLabel" type="Label" parent="MarginContainer/VBoxContainer/TabContainer/Graphics/MarginContainer/GridContainer"]
layout_mode = 2
text = "Window mode"
[node name="WindowModeOptionButton" type="OptionButton" parent="MarginContainer/VBoxContainer/TabContainer/Graphics/MarginContainer/GridContainer"]
unique_name_in_owner = true
layout_mode = 2
item_count = 2
selected = 0
popup/item_0/text = "Windowed"
popup/item_0/id = 0
popup/item_1/text = "Fullscreen"
popup/item_1/id = 1
[node name="VBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 0
[node name="Menu" type="Button" parent="MarginContainer/VBoxContainer/VBoxContainer"]
layout_mode = 2
text = "Back to Main Menu
"
[node name="Save" type="Button" parent="MarginContainer/VBoxContainer/VBoxContainer"]
layout_mode = 2
text = "Apply Settings"
[connection signal="pressed" from="MarginContainer/VBoxContainer/VBoxContainer/Menu" to="." method="_on_menu_pressed"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/VBoxContainer/Save" to="." method="_on_save_pressed"]

View file

@ -50,7 +50,13 @@ func _set_game_mode(new_mode : Node) -> void:
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
add_child(mode)
func _unhandled_input(_event : InputEvent) -> void:
func _unhandled_input(event : InputEvent) -> void:
# switch window mode
if event.is_action_pressed(\"window_mode\"):
if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
else:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
# switch mouse mode
if OS.is_debug_build() and Input.is_action_just_pressed(\"toggle_mouse_capture\"):
if Input.mouse_mode == Input.MOUSE_MODE_VISIBLE: