diff --git a/menu/MainMenu.gd b/menu/MainMenu.gd new file mode 100644 index 0000000..2348f08 --- /dev/null +++ b/menu/MainMenu.gd @@ -0,0 +1,17 @@ +extends Control + + +func _ready(): + pass + + +func _on_NewButton_pressed(): + get_tree().change_scene("res://world/game.tscn") + + +func _on_LoadButton_pressed(): + pass # Replace with function body. + + +func _on_QuitButton_pressed(): + get_tree().quit() diff --git a/menu/MainMenu.tscn b/menu/MainMenu.tscn new file mode 100644 index 0000000..e447b5c --- /dev/null +++ b/menu/MainMenu.tscn @@ -0,0 +1,47 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://theme/theme.tres" type="Theme" id=1] +[ext_resource path="res://menu/MainMenu.gd" type="Script" id=2] + +[sub_resource type="Theme" id=1] + +[node name="MainMenu" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +theme = ExtResource( 1 ) +script = ExtResource( 2 ) + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -158.0 +margin_top = -74.5 +margin_right = 158.0 +margin_bottom = 74.5 + +[node name="NewButton" type="Button" parent="VBoxContainer"] +margin_right = 316.0 +margin_bottom = 47.0 +theme = SubResource( 1 ) +text = "Nouveau monde" +flat = true + +[node name="LoadButton" type="Button" parent="VBoxContainer"] +margin_top = 51.0 +margin_right = 316.0 +margin_bottom = 98.0 +text = "Charger un monde" +flat = true + +[node name="QuitButton" type="Button" parent="VBoxContainer"] +margin_top = 102.0 +margin_right = 316.0 +margin_bottom = 149.0 +text = "Quitter" +flat = true + +[connection signal="pressed" from="VBoxContainer/NewButton" to="." method="_on_NewButton_pressed"] +[connection signal="pressed" from="VBoxContainer/LoadButton" to="." method="_on_LoadButton_pressed"] +[connection signal="pressed" from="VBoxContainer/QuitButton" to="." method="_on_QuitButton_pressed"] diff --git a/project.godot b/project.godot index 42ff1a3..1a7a8ad 100644 --- a/project.godot +++ b/project.godot @@ -45,7 +45,7 @@ _global_script_class_icons={ [application] config/name="Societer" -run/main_scene="res://world/game.tscn" +run/main_scene="res://menu/MainMenu.tscn" config/icon="res://icon.png" [autoload] diff --git a/theme/fonts/monogram.ttf b/theme/fonts/monogram.ttf new file mode 100644 index 0000000..aceaeba Binary files /dev/null and b/theme/fonts/monogram.ttf differ diff --git a/theme/theme.tres b/theme/theme.tres new file mode 100644 index 0000000..2ee92ca --- /dev/null +++ b/theme/theme.tres @@ -0,0 +1,12 @@ +[gd_resource type="Theme" load_steps=3 format=2] + +[sub_resource type="DynamicFontData" id=1] +font_path = "res://theme/fonts/monogram.ttf" + +[sub_resource type="DynamicFont" id=2] +size = 50 +font_data = SubResource( 1 ) + +[resource] +Button/colors/font_color_hover = Color( 0.819608, 0.211765, 0.211765, 1 ) +Button/fonts/font = SubResource( 2 )