added brightness slider
This commit is contained in:
parent
abd25a59a7
commit
299d5fe09d
9 changed files with 72 additions and 9 deletions
|
@ -15,6 +15,10 @@ run/main_scene="res://src/gui/menu/main.tscn"
|
|||
config/features=PackedStringArray("4.1", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[autoload]
|
||||
|
||||
GlobalWorldEnvironment="*res://src/world_environment.tscn"
|
||||
|
||||
[dotnet]
|
||||
|
||||
project/assembly_name="LD54"
|
||||
|
|
7
src/gui/menu/brightness.gd
Normal file
7
src/gui/menu/brightness.gd
Normal file
|
@ -0,0 +1,7 @@
|
|||
extends HSlider
|
||||
|
||||
|
||||
|
||||
func _on_value_changed(value):
|
||||
print_debug("setting brightness to ", value)
|
||||
GlobalWorldEnvironment.environment.adjustment_brightness = value
|
|
@ -1,5 +1,10 @@
|
|||
extends Control
|
||||
|
||||
@export var first_selection: Control
|
||||
|
||||
func _ready():
|
||||
first_selection.grab_focus()
|
||||
|
||||
func _on_continue_button_pressed():
|
||||
get_tree().current_scene.pause()
|
||||
|
||||
|
@ -10,4 +15,5 @@ func _on_menu_button_pressed():
|
|||
func _on_options_button_pressed():
|
||||
var options = load("res://src/gui/menu/options.tscn").instantiate()
|
||||
get_parent().add_child((options))
|
||||
options.last_menu = self
|
||||
hide()
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://dyo5dblkfivwn"]
|
||||
[gd_scene load_steps=3 format=3 uid="uid://c0sexrwxdge73"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://dpktnl3r5wul1" path="res://src/gui/menu_theme.tres" id="1_62uke"]
|
||||
[ext_resource type="Script" path="res://src/gui/menu/level.gd" id="2_6ldjx"]
|
||||
|
||||
[node name="level" type="Control"]
|
||||
[node name="level" type="Control" node_paths=PackedStringArray("first_selection")]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
|
@ -12,6 +12,7 @@ grow_horizontal = 2
|
|||
grow_vertical = 2
|
||||
theme = ExtResource("1_62uke")
|
||||
script = ExtResource("2_6ldjx")
|
||||
first_selection = NodePath("Pause/VBoxContainer/ContinueButton")
|
||||
|
||||
[node name="Pause" type="Panel" parent="."]
|
||||
layout_mode = 1
|
||||
|
|
|
@ -2,11 +2,13 @@ extends Control
|
|||
|
||||
@export var main_menu: Control
|
||||
@export var level_select: Control
|
||||
@export var first_selection: Control
|
||||
@export var level_first_selection: Control
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
$Main/VBoxContainer/StartButton.grab_focus()
|
||||
first_selection.grab_focus()
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
|
@ -18,11 +20,13 @@ func _on_start_button_pressed():
|
|||
# get_tree().change_scene("res://game/main.tscn")
|
||||
main_menu.hide()
|
||||
level_select.show()
|
||||
level_first_selection.grab_focus()
|
||||
|
||||
|
||||
func _on_options_button_pressed():
|
||||
var options = load("res://src/gui/menu/options.tscn").instantiate()
|
||||
get_parent().add_child((options))
|
||||
options.last_menu = self
|
||||
hide()
|
||||
|
||||
func _on_quit_button_pressed():
|
||||
|
@ -31,6 +35,7 @@ func _on_quit_button_pressed():
|
|||
func _on_back_button_pressed():
|
||||
level_select.hide()
|
||||
main_menu.show()
|
||||
first_selection.grab_focus()
|
||||
|
||||
func _on_level_button_pressed(level:int):
|
||||
load_level("res://src/game/levels/level_%s.tscn" % level)
|
||||
|
|
|
@ -54,7 +54,7 @@ Button/styles/normal = SubResource("StyleBoxFlat_uo2yv")
|
|||
Button/styles/pressed = SubResource("StyleBoxFlat_sjhib")
|
||||
Panel/styles/panel = SubResource("StyleBoxFlat_5it3g")
|
||||
|
||||
[node name="Menu" type="Control" node_paths=PackedStringArray("main_menu", "level_select")]
|
||||
[node name="Menu" type="Control" node_paths=PackedStringArray("main_menu", "level_select", "first_selection", "level_first_selection")]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
|
@ -67,6 +67,8 @@ theme = SubResource("Theme_67fiq")
|
|||
script = ExtResource("1_p5r7q")
|
||||
main_menu = NodePath("Main")
|
||||
level_select = NodePath("LevelSelect")
|
||||
first_selection = NodePath("Main/VBoxContainer/StartButton")
|
||||
level_first_selection = NodePath("LevelSelect/VBoxContainer/VBoxContainer2/Row1/1")
|
||||
|
||||
[node name="Main" type="Panel" parent="."]
|
||||
layout_mode = 1
|
||||
|
@ -268,6 +270,11 @@ volume_db = -29.953
|
|||
autoplay = true
|
||||
bus = &"Music"
|
||||
|
||||
[node name="menubox" type="Control" parent="."]
|
||||
anchors_preset = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
|
||||
[connection signal="pressed" from="Main/VBoxContainer/StartButton" to="." method="_on_start_button_pressed"]
|
||||
[connection signal="pressed" from="Main/VBoxContainer/OptionsButton" to="." method="_on_options_button_pressed"]
|
||||
[connection signal="pressed" from="Main/VBoxContainer/QuitButton" to="." method="_on_quit_button_pressed"]
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
extends Control
|
||||
|
||||
@export var first_selection: Control
|
||||
|
||||
var last_menu: Control
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
first_selection.grab_focus()
|
||||
|
||||
func _on_back_button_pressed():
|
||||
get_parent().get_child(0).show()
|
||||
last_menu.show()
|
||||
queue_free()
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://fqg6y7xp34u0"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://fqg6y7xp34u0"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/gui/menu/options.gd" id="1_0813x"]
|
||||
[ext_resource type="Theme" uid="uid://dpktnl3r5wul1" path="res://src/gui/menu_theme.tres" id="1_stpo1"]
|
||||
[ext_resource type="Script" path="res://src/gui/menu/volume_slider.gd" id="3_2vqm2"]
|
||||
[ext_resource type="Script" path="res://src/gui/menu/brightness.gd" id="4_gybdg"]
|
||||
|
||||
[node name="options" type="Control"]
|
||||
[node name="options" type="Control" node_paths=PackedStringArray("first_selection")]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
|
@ -13,6 +14,7 @@ grow_horizontal = 2
|
|||
grow_vertical = 2
|
||||
theme = ExtResource("1_stpo1")
|
||||
script = ExtResource("1_0813x")
|
||||
first_selection = NodePath("Background/BackButton")
|
||||
|
||||
[node name="Background" type="Panel" parent="."]
|
||||
layout_mode = 1
|
||||
|
@ -49,9 +51,9 @@ anchor_top = 0.5
|
|||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -102.0
|
||||
offset_top = -84.0
|
||||
offset_top = -102.0
|
||||
offset_right = 102.0
|
||||
offset_bottom = 120.0
|
||||
offset_bottom = 102.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
|
@ -120,6 +122,20 @@ step = 0.001
|
|||
script = ExtResource("3_2vqm2")
|
||||
bus_name = "Sfx"
|
||||
|
||||
[node name="Label2" type="Label" parent="Background/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "BRIGHTNESS"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Brightness" type="HSlider" parent="Background/VBoxContainer"]
|
||||
custom_minimum_size = Vector2(125, 0)
|
||||
layout_mode = 2
|
||||
min_value = 0.01
|
||||
max_value = 4.0
|
||||
step = 0.01
|
||||
value = 1.0
|
||||
script = ExtResource("4_gybdg")
|
||||
|
||||
[node name="BackButton" type="Button" parent="Background"]
|
||||
custom_minimum_size = Vector2(120, 40)
|
||||
layout_mode = 1
|
||||
|
@ -139,4 +155,5 @@ size_flags_vertical = 8
|
|||
focus_neighbor_bottom = NodePath("../StartButton")
|
||||
text = "Back"
|
||||
|
||||
[connection signal="value_changed" from="Background/VBoxContainer/Brightness" to="Background/VBoxContainer/Brightness" method="_on_value_changed"]
|
||||
[connection signal="pressed" from="Background/BackButton" to="." method="_on_back_button_pressed"]
|
||||
|
|
8
src/world_environment.tscn
Normal file
8
src/world_environment.tscn
Normal file
|
@ -0,0 +1,8 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://6eet3w6wn1pn"]
|
||||
|
||||
[sub_resource type="Environment" id="Environment_1wedi"]
|
||||
background_mode = 3
|
||||
adjustment_enabled = true
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment"]
|
||||
environment = SubResource("Environment_1wedi")
|
Loading…
Reference in a new issue