Skip to content

Commit

Permalink
Merge pull request #9 from monban/menu-improvements
Browse files Browse the repository at this point in the history
Menu improvements
  • Loading branch information
nicemicro authored Oct 11, 2020
2 parents d604a2d + d09ed34 commit 970013b
Show file tree
Hide file tree
Showing 8 changed files with 205 additions and 126 deletions.
20 changes: 0 additions & 20 deletions src/Scenes/Title.gd

This file was deleted.

105 changes: 0 additions & 105 deletions src/Scenes/Title.tscn

This file was deleted.

46 changes: 46 additions & 0 deletions src/Scenes/UI/Settings.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[gd_scene load_steps=2 format=2]

[ext_resource path="res://Scripts/Settings.gd" type="Script" id=1]


[node name="Settings" type="ScrollContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="VBoxContainer" type="VBoxContainer" parent="."]
margin_right = 1024.0
margin_bottom = 64.0
size_flags_horizontal = 3

[node name="Fullscreen" type="HBoxContainer" parent="VBoxContainer"]
margin_right = 1024.0
margin_bottom = 40.0
size_flags_horizontal = 3

[node name="Fullscreen" type="Label" parent="VBoxContainer/Fullscreen"]
margin_top = 13.0
margin_right = 944.0
margin_bottom = 27.0
size_flags_horizontal = 3
text = "FULLSCREEN"
align = 1
valign = 1

[node name="Fullscreen_toggle" type="CheckButton" parent="VBoxContainer/Fullscreen"]
margin_left = 948.0
margin_right = 1024.0
margin_bottom = 40.0

[node name="Back" type="Button" parent="VBoxContainer"]
margin_top = 44.0
margin_right = 1024.0
margin_bottom = 64.0
text = "BACK"
[connection signal="toggled" from="VBoxContainer/Fullscreen/Fullscreen_toggle" to="." method="_on_Fullscreen_toggle_toggled"]
[connection signal="pressed" from="VBoxContainer/Back" to="." method="_on_Back_pressed"]
134 changes: 134 additions & 0 deletions src/Scenes/UI/Title.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
[gd_scene load_steps=6 format=2]

[ext_resource path="res://Assets/Fonts/title-font.tres" type="DynamicFont" id=1]
[ext_resource path="res://Scripts/Languages.gd" type="Script" id=2]
[ext_resource path="res://Scripts/Title.gd" type="Script" id=3]
[ext_resource path="res://Scripts/MainMenu.gd" type="Script" id=4]
[ext_resource path="res://Scenes/UI/Settings.tscn" type="PackedScene" id=5]

[node name="TitleScreen" type="MarginContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
custom_constants/margin_right = 64
custom_constants/margin_top = 64
custom_constants/margin_left = 64
custom_constants/margin_bottom = 64
script = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="VBoxContainer" type="VBoxContainer" parent="."]
margin_left = 64.0
margin_top = 64.0
margin_right = 960.0
margin_bottom = 536.0

[node name="CenterContainer" type="CenterContainer" parent="VBoxContainer"]
margin_right = 896.0
margin_bottom = 234.0
size_flags_vertical = 3

[node name="Title" type="Label" parent="VBoxContainer/CenterContainer"]
margin_left = 255.0
margin_top = 74.0
margin_right = 640.0
margin_bottom = 160.0
custom_fonts/font = ExtResource( 1 )
text = "OpenSuspect"

[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer"]
margin_top = 238.0
margin_right = 896.0
margin_bottom = 472.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_constants/margin_right = 64
custom_constants/margin_left = 64

[node name="MainMenu" type="MarginContainer" parent="VBoxContainer/MarginContainer"]
margin_left = 64.0
margin_right = 832.0
margin_bottom = 234.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_constants/margin_right = 64
custom_constants/margin_left = 64
script = ExtResource( 4 )

[node name="MenuItems" type="VBoxContainer" parent="VBoxContainer/MarginContainer/MainMenu"]
margin_left = 64.0
margin_right = 704.0
margin_bottom = 234.0
size_flags_vertical = 3
custom_constants/separation = 16

[node name="NewGame" type="Button" parent="VBoxContainer/MarginContainer/MainMenu/MenuItems"]
margin_right = 640.0
margin_bottom = 20.0
text = "NEW_GAME"
flat = true

[node name="Appearence" type="Button" parent="VBoxContainer/MarginContainer/MainMenu/MenuItems"]
margin_top = 36.0
margin_right = 640.0
margin_bottom = 56.0
text = "EDIT_APPEARENCE"
flat = true
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Settings" type="Button" parent="VBoxContainer/MarginContainer/MainMenu/MenuItems"]
margin_top = 72.0
margin_right = 640.0
margin_bottom = 92.0
text = "SETTINGS"
flat = true
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Language" type="Button" parent="VBoxContainer/MarginContainer/MainMenu/MenuItems"]
margin_top = 108.0
margin_right = 640.0
margin_bottom = 128.0
text = "LANGUAGE"
flat = true

[node name="AppearenceEditor" type="HBoxContainer" parent="VBoxContainer/MarginContainer/MainMenu"]
visible = false
margin_left = 64.0
margin_right = 704.0
margin_bottom = 234.0

[node name="LanguageSelector" type="ScrollContainer" parent="VBoxContainer/MarginContainer/MainMenu"]
visible = false
margin_left = 64.0
margin_right = 704.0
margin_bottom = 234.0
rect_min_size = Vector2( 0, 100 )
size_flags_horizontal = 3
size_flags_vertical = 3

[node name="LanguageList" type="VBoxContainer" parent="VBoxContainer/MarginContainer/MainMenu/LanguageSelector"]
margin_right = 640.0
margin_bottom = 234.0
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource( 2 )

[node name="Button" type="Button" parent="VBoxContainer/MarginContainer/MainMenu/LanguageSelector/LanguageList"]
margin_right = 640.0
margin_bottom = 20.0
text = "Test button"

[node name="Settings" parent="VBoxContainer/MarginContainer/MainMenu" instance=ExtResource( 5 )]
visible = false
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 64.0
margin_right = 704.0
margin_bottom = 234.0
[connection signal="pressed" from="VBoxContainer/MarginContainer/MainMenu/MenuItems/NewGame" to="VBoxContainer/MarginContainer/MainMenu" method="_on_NewGame_pressed"]
[connection signal="pressed" from="VBoxContainer/MarginContainer/MainMenu/MenuItems/Settings" to="VBoxContainer/MarginContainer/MainMenu" method="_on_Settings_pressed"]
17 changes: 17 additions & 0 deletions src/Scripts/MainMenu.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
extends MarginContainer

func _ready():
_on_Return()

func _on_NewGame_pressed():
get_tree().change_scene("res://Scenes/main.tscn")


func _on_Settings_pressed():
get_node("MenuItems").visible = false
get_node("Settings").visible = true

func _on_Return():
get_node("Settings").visible = false
get_node("LanguageSelector").visible = false
get_node("MenuItems").visible = true
6 changes: 6 additions & 0 deletions src/Scripts/Settings.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
extends ScrollContainer
func _ready():
$VBoxContainer/Back.connect("pressed", get_node(".."), "_on_Return")

func _on_Fullscreen_toggle_toggled(button_pressed):
OS.window_fullscreen = button_pressed
1 change: 1 addition & 0 deletions src/Scripts/Title.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extends MarginContainer
2 changes: 1 addition & 1 deletion src/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ _global_script_class_icons={
[application]

config/name="opensuspect"
run/main_scene="res://Scenes/Title.tscn"
run/main_scene="res://Scenes/UI/Title.tscn"
config/icon="res://icon.png"

[input]
Expand Down

0 comments on commit 970013b

Please sign in to comment.