2
0
Эх сурвалжийг харах

Merge pull request #49 from groud/allow_going_back_to_menu

Allow going back and forth to the main menu, and toggle fullscreen with Alt+tab
Aaron Franke 5 жил өмнө
parent
commit
9a9e4aca87

+ 12 - 0
level/level.gd

@@ -1,5 +1,11 @@
 extends Spatial
 
+
+signal quit
+#warning-ignore:unused_signal
+signal replace_main_scene # Useless, but needed as there is no clean way to check if a node exposes a signal
+
+
 func _ready():
 	if settings.gi_quality == settings.GIQuality.HIGH:
 		ProjectSettings["rendering/quality/voxel_cone_tracing/high_quality"] = true
@@ -36,3 +42,9 @@ func _ready():
 	elif settings.resolution == settings.Resolution.RES_576:
 		var minsize = Vector2(OS.window_size.x * 576 / OS.window_size.y, 576.0)
 		get_tree().set_screen_stretch(SceneTree.STRETCH_MODE_VIEWPORT,SceneTree.STRETCH_ASPECT_KEEP_HEIGHT,minsize)
+
+
+func _input(event):
+	if event.is_action_pressed("quit"):
+		Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
+		emit_signal("quit")

+ 31 - 0
main/main.gd

@@ -0,0 +1,31 @@
+extends Node
+
+func _ready():
+	OS.window_fullscreen = settings.fullscreen
+	go_to_main_menu()
+
+
+func go_to_main_menu():
+	var menu = ResourceLoader.load("res://menu/menu.tscn")
+	change_scene(menu)
+
+
+func replace_main_scene(resource):
+	call_deferred("change_scene", resource)
+
+
+func change_scene(resource : Resource):
+	var node = resource.instance()
+	
+	while get_child_count() > 0:
+		remove_child(get_child(0))
+	add_child(node)
+	
+	node.connect("quit", self, "go_to_main_menu")
+	node.connect("replace_main_scene", self, "replace_main_scene")
+
+
+func _input(event : InputEvent):
+	if event.is_action_pressed("toggle_fullscreen"):
+		OS.window_fullscreen = !OS.window_fullscreen
+		get_tree().set_input_as_handled()

+ 6 - 0
main/main.tscn

@@ -0,0 +1,6 @@
+[gd_scene load_steps=2 format=2]
+
+[ext_resource path="res://main/main.gd" type="Script" id=1]
+
+[node name="main" type="Node"]
+script = ExtResource( 1 )

+ 16 - 0
menu/button_action_pressed.tres

@@ -0,0 +1,16 @@
+[gd_resource type="StyleBoxFlat" format=2]
+
+[resource]
+bg_color = Color( 0, 0, 0, 0 )
+border_width_left = 2
+border_width_top = 2
+border_width_right = 2
+border_width_bottom = 2
+border_color = Color( 1, 1, 1, 1 )
+corner_radius_top_left = 6
+corner_radius_top_right = 6
+corner_radius_bottom_right = 6
+corner_radius_bottom_left = 6
+shadow_color = Color( 1, 1, 1, 0.431373 )
+shadow_size = 10
+anti_aliasing = false

+ 17 - 0
menu/button_focus.tres

@@ -0,0 +1,17 @@
+[gd_resource type="StyleBoxFlat" format=2]
+
+[resource]
+bg_color = Color( 0, 0, 0, 0 )
+draw_center = false
+border_width_left = 4
+border_width_top = 4
+border_width_right = 4
+border_width_bottom = 4
+border_color = Color( 0.321569, 0.396078, 0.890196, 0.752941 )
+border_blend = true
+corner_radius_top_left = 6
+corner_radius_top_right = 6
+corner_radius_bottom_right = 6
+corner_radius_bottom_left = 6
+anti_aliasing = false
+anti_aliasing_size = 2

+ 17 - 0
menu/button_hover.tres

@@ -0,0 +1,17 @@
+[gd_resource type="StyleBoxFlat" format=2]
+
+[resource]
+bg_color = Color( 0, 0, 0, 0 )
+draw_center = false
+border_width_left = 2
+border_width_top = 2
+border_width_right = 2
+border_width_bottom = 2
+border_color = Color( 1, 1, 1, 1 )
+corner_radius_top_left = 6
+corner_radius_top_right = 6
+corner_radius_bottom_right = 6
+corner_radius_bottom_left = 6
+shadow_color = Color( 1, 1, 1, 0.431373 )
+shadow_size = 10
+anti_aliasing = false

+ 0 - 17
menu/button_normal.tres

@@ -1,31 +1,14 @@
 [gd_resource type="StyleBoxFlat" format=2]
 
 [resource]
-
-content_margin_left = -1.0
-content_margin_right = -1.0
-content_margin_top = -1.0
-content_margin_bottom = -1.0
 bg_color = Color( 0, 0, 0, 0 )
-draw_center = true
 border_width_left = 2
 border_width_top = 2
 border_width_right = 2
 border_width_bottom = 2
 border_color = Color( 0.145098, 0.145098, 0.145098, 1 )
-border_blend = false
 corner_radius_top_left = 6
 corner_radius_top_right = 6
 corner_radius_bottom_right = 6
 corner_radius_bottom_left = 6
-corner_detail = 8
-expand_margin_left = 0.0
-expand_margin_right = 0.0
-expand_margin_top = 0.0
-expand_margin_bottom = 0.0
 shadow_color = Color( 1, 1, 1, 0.0901961 )
-shadow_size = 0
-anti_aliasing = true
-anti_aliasing_size = 1
-_sections_unfolded = [ "Anti Aliasing", "Border", "Border Width", "Corner Radius", "Shadow" ]
-

+ 4 - 17
menu/button_pressed.tres

@@ -1,31 +1,18 @@
 [gd_resource type="StyleBoxFlat" format=2]
 
 [resource]
-
-content_margin_left = -1.0
-content_margin_right = -1.0
-content_margin_top = -1.0
-content_margin_bottom = -1.0
 bg_color = Color( 0, 0, 0, 0 )
 draw_center = false
 border_width_left = 2
 border_width_top = 2
 border_width_right = 2
 border_width_bottom = 2
-border_color = Color( 0.8, 0.8, 0.8, 1 )
-border_blend = false
+border_blend = true
 corner_radius_top_left = 6
 corner_radius_top_right = 6
 corner_radius_bottom_right = 6
 corner_radius_bottom_left = 6
-corner_detail = 8
-expand_margin_left = 0.0
-expand_margin_right = 0.0
-expand_margin_top = 0.0
-expand_margin_bottom = 0.0
 shadow_color = Color( 1, 1, 1, 0.6 )
-shadow_size = 3
-anti_aliasing = true
-anti_aliasing_size = 1
-_sections_unfolded = [ "Anti Aliasing", "Border Width", "Corner Radius", "Shadow" ]
-
+shadow_size = 10
+anti_aliasing = false
+anti_aliasing_size = 2

+ 55 - 36
menu/menu.gd

@@ -3,7 +3,12 @@ extends Spatial
 var res_loader : ResourceInteractiveLoader = null
 var loading_thread : Thread = null
 
+signal replace_main_scene
+#warning-ignore:unused_signal
+signal quit # Useless, but needed as there is no clean way to check if a node exposes a signal
+
 func _ready():
+	get_tree().set_screen_stretch(SceneTree.STRETCH_MODE_2D, SceneTree.STRETCH_ASPECT_KEEP, Vector2(1920, 1080))
 	$ui/main/play.grab_focus()
 
 
@@ -26,59 +31,68 @@ func interactive_load(loader):
 
 func loading_done(loader):
 	loading_thread.wait_to_finish()
-	#warning-ignore:return_value_discarded
-	get_tree().change_scene_to(loader.get_resource())
+	emit_signal("replace_main_scene", loader.get_resource())
+	res_loader = null # Weirdly, this is needed as otherwise loading the resource again is not possible
 
 
 func _on_loading_done_timer_timeout():
-	call_deferred("loading_done", res_loader)
+	loading_done(res_loader)
 
 
 func _on_play_pressed():
 	$ui/main.hide()
 	$ui/loading.show()
-	res_loader = ResourceLoader.load_interactive("res://level/level.tscn")
-	loading_thread = Thread.new()
-	#warning-ignore:return_value_discarded
-	loading_thread.start(self, "interactive_load", res_loader)
+	var path = "res://level/level.tscn"
+	if ResourceLoader.has_cached(path):
+		emit_signal("replace_main_scene", ResourceLoader.load(path))
+	else:
+		res_loader = ResourceLoader.load_interactive(path)
+		loading_thread = Thread.new()
+		#warning-ignore:return_value_discarded
+		loading_thread.start(self, "interactive_load", res_loader)
 
 
 func _on_settings_pressed():
 	$ui/main.hide()
 	$ui/settings.show()
-	$ui/settings/cancel.grab_focus()
+	$ui/settings/actions/cancel.grab_focus()
 	
 	if settings.gi_quality == settings.GIQuality.HIGH:
-		$ui/settings/gi_high.pressed=true
+		$ui/settings/gi/gi_high.pressed=true
 	elif settings.gi_quality == settings.GIQuality.LOW:
-		$ui/settings/gi_low.pressed=true
+		$ui/settings/gi/gi_low.pressed=true
 	elif settings.gi_quality == settings.GIQuality.DISABLED:
-		$ui/settings/gi_disabled.pressed=true
+		$ui/settings/gi/gi_disabled.pressed=true
 
 	if settings.aa_quality == settings.AAQuality.AA_8X:
-		$ui/settings/aa_8x.pressed=true
+		$ui/settings/aa/aa_8x.pressed=true
 	elif settings.aa_quality == settings.AAQuality.AA_4X:
-		$ui/settings/aa_4x.pressed=true
+		$ui/settings/aa/aa_4x.pressed=true
 	elif settings.aa_quality == settings.AAQuality.AA_2X:
-		$ui/settings/aa_2x.pressed=true
+		$ui/settings/aa/aa_2x.pressed=true
 	elif settings.aa_quality == settings.AAQuality.AA_DISABLED:
-		$ui/settings/aa_disabled.pressed=true
+		$ui/settings/aa/aa_disabled.pressed=true
 
 	if settings.ssao_quality == settings.SSAOQuality.HIGH:
-		$ui/settings/ssao_high.pressed=true
+		$ui/settings/ssao/ssao_high.pressed=true
 	elif settings.ssao_quality == settings.SSAOQuality.LOW:
-		$ui/settings/ssao_low.pressed=true
+		$ui/settings/ssao/ssao_low.pressed=true
 	elif settings.ssao_quality == settings.SSAOQuality.DISABLED:
-		$ui/settings/ssao_disabled.pressed=true
+		$ui/settings/ssao/ssao_disabled.pressed=true
 		
 	if settings.resolution == settings.Resolution.NATIVE:
-		$ui/settings/resolution_native.pressed = true
+		$ui/settings/resolution/resolution_native.pressed = true
 	elif settings.resolution == settings.Resolution.RES_1080:
-		$ui/settings/resolution_1080.pressed = true
+		$ui/settings/resolution/resolution_1080.pressed = true
 	elif settings.resolution == settings.Resolution.RES_720:
-		$ui/settings/resolution_720.pressed = true
+		$ui/settings/resolution/resolution_720.pressed = true
 	elif settings.resolution == settings.Resolution.RES_576:
-		$ui/settings/resolution_576.pressed = true
+		$ui/settings/resolution/resolution_576.pressed = true
+
+	if settings.fullscreen:
+		$ui/settings/fullscreen/fullscreen_yes.pressed = true
+	else:
+		$ui/settings/fullscreen/fullscreen_no.pressed = true
 
 
 func _on_quit_pressed():
@@ -90,38 +104,43 @@ func _on_apply_pressed():
 	$ui/main/play.grab_focus()
 	$ui/settings.hide()
 	
-	if $ui/settings/gi_high.pressed:
+	if $ui/settings/gi/gi_high.pressed:
 		settings.gi_quality = settings.GIQuality.HIGH
-	elif $ui/settings/gi_low.pressed:
+	elif $ui/settings/gi/gi_low.pressed:
 		settings.gi_quality = settings.GIQuality.LOW
-	elif $ui/settings/gi_disabled.pressed:
+	elif $ui/settings/gi/gi_disabled.pressed:
 		settings.gi_quality = settings.GIQuality.DISABLED
 	
-	if $ui/settings/aa_8x.pressed:
+	if $ui/settings/aa/aa_8x.pressed:
 		settings.aa_quality = settings.AAQuality.AA_8X
-	elif $ui/settings/aa_4x.pressed:
+	elif $ui/settings/aa/aa_4x.pressed:
 		settings.aa_quality = settings.AAQuality.AA_4X
-	elif $ui/settings/aa_2x.pressed:
+	elif $ui/settings/aa/aa_2x.pressed:
 		settings.aa_quality = settings.AAQuality.AA_2X
-	elif $ui/settings/aa_disabled.pressed:
+	elif $ui/settings/aa/aa_disabled.pressed:
 		settings.aa_quality = settings.AAQuality.AA_DISABLED
 	
-	if $ui/settings/ssao_high.pressed:
+	if $ui/settings/ssao/ssao_high.pressed:
 		settings.ssao_quality = settings.SSAOQuality.HIGH
-	elif $ui/settings/ssao_low.pressed:
+	elif $ui/settings/ssao/ssao_low.pressed:
 		settings.ssao_quality = settings.SSAOQuality.LOW
-	elif $ui/settings/ssao_disabled.pressed:
+	elif $ui/settings/ssao/ssao_disabled.pressed:
 		settings.ssao_quality = settings.SSAOQuality.DISABLED
 	
-	if $ui/settings/resolution_native.pressed:
+	if $ui/settings/resolution/resolution_native.pressed:
 		settings.resolution = settings.Resolution.NATIVE
-	elif $ui/settings/resolution_1080.pressed:
+	elif $ui/settings/resolution/resolution_1080.pressed:
 		settings.resolution = settings.Resolution.RES_1080
-	elif $ui/settings/resolution_720.pressed:
+	elif $ui/settings/resolution/resolution_720.pressed:
 		settings.resolution = settings.Resolution.RES_720
-	elif $ui/settings/resolution_576.pressed:
+	elif $ui/settings/resolution/resolution_576.pressed:
 		settings.resolution = settings.Resolution.RES_576
+
+	settings.fullscreen = $ui/settings/fullscreen/fullscreen_yes.pressed
 	
+	# Apply the setting directly
+	OS.window_fullscreen = settings.fullscreen
+
 	settings.save_settings()
 
 

+ 243 - 373
menu/menu.tscn

@@ -1,4 +1,4 @@
-[gd_scene load_steps=68 format=2]
+[gd_scene load_steps=37 format=2]
 
 [ext_resource path="res://menu/menu.gd" type="Script" id=1]
 [ext_resource path="res://menu/experiment.hdr" type="Texture" id=2]
@@ -15,6 +15,9 @@
 [ext_resource path="res://menu/button_font.tres" type="DynamicFont" id=13]
 [ext_resource path="res://menu/button_pressed.tres" type="StyleBox" id=14]
 [ext_resource path="res://menu/button_normal.tres" type="StyleBox" id=15]
+[ext_resource path="res://menu/button_focus.tres" type="StyleBox" id=16]
+[ext_resource path="res://menu/button_hover.tres" type="StyleBox" id=17]
+[ext_resource path="res://menu/button_action_pressed.tres" type="StyleBox" id=18]
 
 [sub_resource type="PanoramaSky" id=1]
 panorama = ExtResource( 2 )
@@ -58,156 +61,39 @@ nodes/Animation/position = Vector2( -120, 100 )
 nodes/Blend2/node = SubResource( 7 )
 nodes/Blend2/position = Vector2( 180, 120 )
 nodes/output/position = Vector2( 420, 120 )
-node_connections = [ "Blend2", 0, "Animation", "Blend2", 1, "Animation 2", "output", 0, "Blend2" ]
-
-[sub_resource type="StyleBoxEmpty" id=9]
+node_connections = [ "output", 0, "Blend2", "Blend2", 0, "Animation", "Blend2", 1, "Animation 2" ]
+
+[sub_resource type="Theme" id=57]
+Button/colors/font_color = Color( 1, 1, 1, 1 )
+Button/colors/font_color_disabled = Color( 0.9, 0.9, 0.9, 0.2 )
+Button/colors/font_color_hover = Color( 1, 1, 1, 1 )
+Button/colors/font_color_pressed = Color( 1, 1, 1, 1 )
+Button/constants/hseparation = 2
+Button/fonts/font = ExtResource( 13 )
+Button/styles/disabled = null
+Button/styles/focus = ExtResource( 16 )
+Button/styles/hover = ExtResource( 17 )
+Button/styles/normal = ExtResource( 15 )
+Button/styles/pressed = ExtResource( 14 )
+Label/colors/font_color = Color( 1, 1, 1, 1 )
+Label/colors/font_color_shadow = Color( 0, 0, 0, 0 )
+Label/colors/font_outline_modulate = Color( 1, 1, 1, 1 )
+Label/constants/line_spacing = 3
+Label/constants/shadow_as_outline = 0
+Label/constants/shadow_offset_x = 1
+Label/constants/shadow_offset_y = 1
+Label/fonts/font = ExtResource( 13 )
+Label/styles/normal = null
 
 [sub_resource type="ButtonGroup" id=10]
 
-[sub_resource type="StyleBoxEmpty" id=11]
-
-[sub_resource type="DynamicFontData" id=12]
-font_path = "res://menu/font/PT_Sans-Web-Bold.ttf"
-
-[sub_resource type="DynamicFont" id=13]
-size = 40
-font_data = SubResource( 12 )
-
-[sub_resource type="StyleBoxEmpty" id=14]
-
-[sub_resource type="DynamicFontData" id=15]
-font_path = "res://menu/font/PT_Sans-Web-Bold.ttf"
-
-[sub_resource type="DynamicFont" id=16]
-size = 40
-font_data = SubResource( 15 )
-
-[sub_resource type="DynamicFontData" id=17]
-font_path = "res://menu/font/PT_Sans-Web-Bold.ttf"
-
-[sub_resource type="DynamicFont" id=18]
-size = 40
-font_data = SubResource( 17 )
-
-[sub_resource type="StyleBoxFlat" id=19]
-bg_color = Color( 0, 0, 0, 0 )
-draw_center = false
-border_width_left = 2
-border_width_top = 2
-border_width_right = 2
-border_width_bottom = 2
-corner_radius_top_left = 6
-corner_radius_top_right = 6
-corner_radius_bottom_right = 6
-corner_radius_bottom_left = 6
-shadow_color = Color( 1, 1, 1, 0.6 )
-shadow_size = 3
-
-[sub_resource type="StyleBoxFlat" id=20]
-bg_color = Color( 0, 0, 0, 0 )
-draw_center = false
-border_width_left = 2
-border_width_top = 2
-border_width_right = 2
-border_width_bottom = 2
-corner_radius_top_left = 6
-corner_radius_top_right = 6
-corner_radius_bottom_right = 6
-corner_radius_bottom_left = 6
-shadow_color = Color( 1, 1, 1, 0.6 )
-shadow_size = 3
-
-[sub_resource type="StyleBoxEmpty" id=21]
-
-[sub_resource type="DynamicFontData" id=22]
-font_path = "res://menu/font/PT_Sans-Web-Bold.ttf"
-
-[sub_resource type="DynamicFont" id=23]
-size = 40
-font_data = SubResource( 22 )
-
 [sub_resource type="ButtonGroup" id=24]
 
-[sub_resource type="StyleBoxEmpty" id=25]
-
-[sub_resource type="DynamicFontData" id=26]
-font_path = "res://menu/font/PT_Sans-Web-Bold.ttf"
-
-[sub_resource type="DynamicFont" id=27]
-size = 40
-font_data = SubResource( 26 )
-
-[sub_resource type="StyleBoxEmpty" id=28]
-
-[sub_resource type="DynamicFontData" id=29]
-font_path = "res://menu/font/PT_Sans-Web-Bold.ttf"
-
-[sub_resource type="DynamicFont" id=30]
-size = 40
-font_data = SubResource( 29 )
-
-[sub_resource type="StyleBoxEmpty" id=31]
-
-[sub_resource type="DynamicFontData" id=32]
-font_path = "res://menu/font/PT_Sans-Web-Bold.ttf"
-
-[sub_resource type="DynamicFont" id=33]
-size = 40
-font_data = SubResource( 32 )
-
-[sub_resource type="DynamicFontData" id=34]
-font_path = "res://menu/font/PT_Sans-Web-Bold.ttf"
-
-[sub_resource type="DynamicFont" id=35]
-size = 40
-font_data = SubResource( 34 )
-
-[sub_resource type="StyleBoxEmpty" id=36]
-
-[sub_resource type="DynamicFontData" id=37]
-font_path = "res://menu/font/PT_Sans-Web-Bold.ttf"
-
-[sub_resource type="DynamicFont" id=38]
-size = 40
-font_data = SubResource( 37 )
-
 [sub_resource type="ButtonGroup" id=39]
 
-[sub_resource type="StyleBoxEmpty" id=40]
-
-[sub_resource type="DynamicFontData" id=41]
-font_path = "res://menu/font/PT_Sans-Web-Bold.ttf"
-
-[sub_resource type="DynamicFont" id=42]
-size = 40
-font_data = SubResource( 41 )
-
-[sub_resource type="StyleBoxEmpty" id=43]
-
-[sub_resource type="DynamicFontData" id=44]
-font_path = "res://menu/font/PT_Sans-Web-Bold.ttf"
-
-[sub_resource type="DynamicFont" id=45]
-size = 40
-font_data = SubResource( 44 )
-
 [sub_resource type="ButtonGroup" id=46]
 
-[sub_resource type="StyleBoxEmpty" id=47]
-
-[sub_resource type="StyleBoxFlat" id=48]
-bg_color = Color( 0, 0, 0, 0 )
-border_width_left = 2
-border_width_top = 2
-border_width_right = 2
-border_width_bottom = 2
-border_color = Color( 0.34902, 0.34902, 0.34902, 1 )
-corner_radius_top_left = 6
-corner_radius_top_right = 6
-corner_radius_bottom_right = 6
-corner_radius_bottom_left = 6
-shadow_color = Color( 1, 1, 1, 0.6 )
-shadow_size = 3
+[sub_resource type="ButtonGroup" id=53]
 
 [sub_resource type="DynamicFontData" id=49]
 font_path = "res://menu/font/PT_Sans-Web-Bold.ttf"
@@ -240,7 +126,7 @@ corner_radius_top_right = 10
 corner_radius_bottom_right = 10
 corner_radius_bottom_left = 10
 
-[node name="main" type="Spatial"]
+[node name="menu" type="Spatial"]
 script = ExtResource( 1 )
 
 [node name="WorldEnvironment" type="WorldEnvironment" parent="."]
@@ -277,10 +163,15 @@ margin_top = 5.03506
 margin_right = 1044.14
 margin_bottom = 238.035
 texture = ExtResource( 6 )
+__meta__ = {
+"_edit_use_anchors_": false
+}
 
 [node name="ui" type="Control" parent="."]
-anchor_right = 1.0
+anchor_left = 0.00106799
+anchor_right = 1.00107
 anchor_bottom = 1.0
+theme = SubResource( 57 )
 __meta__ = {
 "_edit_use_anchors_": false
 }
@@ -328,313 +219,292 @@ texture_normal = ExtResource( 11 )
 texture_pressed = ExtResource( 11 )
 texture_hover = ExtResource( 12 )
 
-[node name="settings" type="Control" parent="ui"]
+[node name="settings" type="VBoxContainer" parent="ui"]
 visible = false
-anchor_right = 1.0
-anchor_bottom = 1.0
+anchor_left = 0.109896
+anchor_top = 0.32037
+anchor_right = 0.808854
+anchor_bottom = 0.785185
+custom_constants/separation = 30
+__meta__ = {
+"_edit_use_anchors_": true
+}
 
-[node name="gi_label" type="Label" parent="ui/settings"]
-margin_left = 30.0
-margin_top = 390.0
-margin_right = 368.0
-margin_bottom = 443.0
-custom_fonts/font = ExtResource( 13 )
+[node name="gi" type="HBoxContainer" parent="ui/settings"]
+margin_right = 1342.0
+margin_bottom = 57.0
+custom_constants/separation = 30
+__meta__ = {
+"_edit_group_": true,
+"_edit_use_anchors_": false
+}
+
+[node name="gi_label" type="Label" parent="ui/settings/gi"]
+margin_top = 2.0
+margin_right = 400.0
+margin_bottom = 55.0
+rect_min_size = Vector2( 400, 0 )
 custom_colors/font_color = Color( 1, 1, 1, 1 )
 text = "Global Illumination:"
 
-[node name="gi_high" type="Button" parent="ui/settings"]
-margin_left = 400.0
-margin_top = 390.0
-margin_right = 650.0
-margin_bottom = 447.0
-custom_styles/hover = ExtResource( 14 )
-custom_styles/pressed = ExtResource( 14 )
-custom_styles/focus = SubResource( 9 )
-custom_styles/normal = ExtResource( 15 )
-custom_fonts/font = ExtResource( 13 )
-custom_colors/font_color = Color( 1, 1, 1, 1 )
-custom_colors/font_color_hover = Color( 1, 1, 1, 1 )
-custom_colors/font_color_pressed = Color( 1, 1, 1, 1 )
+[node name="gi_high" type="Button" parent="ui/settings/gi"]
+margin_left = 430.0
+margin_right = 714.0
+margin_bottom = 57.0
+size_flags_horizontal = 3
 toggle_mode = true
 pressed = true
 group = SubResource( 10 )
 text = "High"
 
-[node name="gi_low" type="Button" parent="ui/settings"]
-margin_left = 690.0
-margin_top = 390.0
-margin_right = 940.0
-margin_bottom = 447.0
-custom_styles/hover = ExtResource( 14 )
-custom_styles/pressed = ExtResource( 14 )
-custom_styles/focus = SubResource( 11 )
-custom_styles/normal = ExtResource( 15 )
-custom_fonts/font = SubResource( 13 )
-custom_colors/font_color = Color( 1, 1, 1, 1 )
-custom_colors/font_color_hover = Color( 1, 1, 1, 1 )
-custom_colors/font_color_pressed = Color( 1, 1, 1, 1 )
+[node name="gi_low" type="Button" parent="ui/settings/gi"]
+margin_left = 744.0
+margin_right = 1028.0
+margin_bottom = 57.0
+size_flags_horizontal = 3
 toggle_mode = true
 group = SubResource( 10 )
 text = "Low"
 
-[node name="gi_disabled" type="Button" parent="ui/settings"]
-margin_left = 980.0
-margin_top = 390.0
-margin_right = 1230.0
-margin_bottom = 447.0
-custom_styles/hover = ExtResource( 14 )
-custom_styles/pressed = ExtResource( 14 )
-custom_styles/focus = SubResource( 14 )
-custom_styles/normal = ExtResource( 15 )
-custom_fonts/font = SubResource( 16 )
-custom_colors/font_color = Color( 1, 1, 1, 1 )
-custom_colors/font_color_hover = Color( 1, 1, 1, 1 )
-custom_colors/font_color_pressed = Color( 1, 1, 1, 1 )
+[node name="gi_disabled" type="Button" parent="ui/settings/gi"]
+margin_left = 1058.0
+margin_right = 1342.0
+margin_bottom = 57.0
+size_flags_horizontal = 3
 toggle_mode = true
 group = SubResource( 10 )
 text = "Disabled"
 
-[node name="aa_label" type="Label" parent="ui/settings"]
-margin_left = 30.0
-margin_top = 510.0
-margin_right = 368.0
-margin_bottom = 563.0
-custom_fonts/font = SubResource( 18 )
+[node name="aa" type="HBoxContainer" parent="ui/settings"]
+margin_top = 87.0
+margin_right = 1342.0
+margin_bottom = 144.0
+custom_constants/separation = 30
+__meta__ = {
+"_edit_group_": true,
+"_edit_use_anchors_": false
+}
+
+[node name="aa_label" type="Label" parent="ui/settings/aa"]
+margin_right = 400.0
+margin_bottom = 57.0
+rect_min_size = Vector2( 400, 0 )
+size_flags_vertical = 1
 custom_colors/font_color = Color( 1, 1, 1, 1 )
 text = "Anti Aliasing:"
 
-[node name="aa_8x" type="Button" parent="ui/settings"]
-margin_left = 400.0
-margin_top = 510.0
-margin_right = 650.0
-margin_bottom = 567.0
-custom_styles/hover = SubResource( 19 )
-custom_styles/pressed = SubResource( 20 )
-custom_styles/focus = SubResource( 21 )
-custom_styles/normal = ExtResource( 15 )
-custom_fonts/font = SubResource( 23 )
-custom_colors/font_color = Color( 1, 1, 1, 1 )
-custom_colors/font_color_hover = Color( 1, 1, 1, 1 )
-custom_colors/font_color_pressed = Color( 1, 1, 1, 1 )
+[node name="aa_8x" type="Button" parent="ui/settings/aa"]
+margin_left = 430.0
+margin_right = 635.0
+margin_bottom = 57.0
+size_flags_horizontal = 3
 toggle_mode = true
 pressed = true
 group = SubResource( 24 )
 text = "8x"
 
-[node name="aa_4x" type="Button" parent="ui/settings"]
-margin_left = 690.0
-margin_top = 510.0
-margin_right = 940.0
-margin_bottom = 567.0
-custom_styles/hover = ExtResource( 14 )
-custom_styles/pressed = ExtResource( 14 )
-custom_styles/focus = SubResource( 25 )
-custom_styles/normal = ExtResource( 15 )
-custom_fonts/font = SubResource( 27 )
-custom_colors/font_color = Color( 1, 1, 1, 1 )
-custom_colors/font_color_hover = Color( 1, 1, 1, 1 )
-custom_colors/font_color_pressed = Color( 1, 1, 1, 1 )
+[node name="aa_4x" type="Button" parent="ui/settings/aa"]
+margin_left = 665.0
+margin_right = 870.0
+margin_bottom = 57.0
+size_flags_horizontal = 3
 toggle_mode = true
 group = SubResource( 24 )
 text = "4x"
 
-[node name="aa_2x" type="Button" parent="ui/settings"]
-margin_left = 980.0
-margin_top = 510.0
-margin_right = 1230.0
-margin_bottom = 567.0
-custom_styles/hover = ExtResource( 14 )
-custom_styles/pressed = ExtResource( 14 )
-custom_styles/focus = SubResource( 28 )
-custom_styles/normal = ExtResource( 15 )
-custom_fonts/font = SubResource( 30 )
-custom_colors/font_color = Color( 1, 1, 1, 1 )
-custom_colors/font_color_hover = Color( 1, 1, 1, 1 )
-custom_colors/font_color_pressed = Color( 1, 1, 1, 1 )
+[node name="aa_2x" type="Button" parent="ui/settings/aa"]
+margin_left = 900.0
+margin_right = 1105.0
+margin_bottom = 57.0
+size_flags_horizontal = 3
 toggle_mode = true
 group = SubResource( 24 )
 text = "2x"
 
-[node name="aa_disabled" type="Button" parent="ui/settings"]
-margin_left = 1270.0
-margin_top = 510.0
-margin_right = 1520.0
-margin_bottom = 567.0
-custom_styles/hover = ExtResource( 14 )
-custom_styles/pressed = ExtResource( 14 )
-custom_styles/focus = SubResource( 31 )
-custom_styles/normal = ExtResource( 15 )
-custom_fonts/font = SubResource( 33 )
-custom_colors/font_color = Color( 1, 1, 1, 1 )
-custom_colors/font_color_hover = Color( 1, 1, 1, 1 )
-custom_colors/font_color_pressed = Color( 1, 1, 1, 1 )
+[node name="aa_disabled" type="Button" parent="ui/settings/aa"]
+margin_left = 1135.0
+margin_right = 1342.0
+margin_bottom = 57.0
+size_flags_horizontal = 3
 toggle_mode = true
 group = SubResource( 24 )
 text = "Disabled"
 
-[node name="ssao_label" type="Label" parent="ui/settings"]
-margin_left = 30.0
-margin_top = 620.0
-margin_right = 368.0
-margin_bottom = 673.0
-custom_fonts/font = SubResource( 35 )
+[node name="ssao" type="HBoxContainer" parent="ui/settings"]
+margin_top = 174.0
+margin_right = 1342.0
+margin_bottom = 231.0
+custom_constants/separation = 30
+__meta__ = {
+"_edit_group_": true
+}
+
+[node name="ssao_label" type="Label" parent="ui/settings/ssao"]
+margin_right = 400.0
+margin_bottom = 57.0
+rect_min_size = Vector2( 400, 0 )
+size_flags_vertical = 1
 custom_colors/font_color = Color( 1, 1, 1, 1 )
 text = "SSAO:"
+__meta__ = {
+"_edit_use_anchors_": false
+}
 
-[node name="ssao_high" type="Button" parent="ui/settings"]
-margin_left = 400.0
-margin_top = 620.0
-margin_right = 650.0
-margin_bottom = 677.0
-custom_styles/hover = ExtResource( 14 )
-custom_styles/pressed = ExtResource( 14 )
-custom_styles/focus = SubResource( 36 )
-custom_styles/normal = ExtResource( 15 )
-custom_fonts/font = SubResource( 38 )
-custom_colors/font_color = Color( 1, 1, 1, 1 )
-custom_colors/font_color_hover = Color( 1, 1, 1, 1 )
-custom_colors/font_color_pressed = Color( 1, 1, 1, 1 )
+[node name="ssao_high" type="Button" parent="ui/settings/ssao"]
+margin_left = 430.0
+margin_right = 714.0
+margin_bottom = 57.0
+size_flags_horizontal = 3
 toggle_mode = true
 pressed = true
 group = SubResource( 39 )
 text = "High"
 
-[node name="ssao_low" type="Button" parent="ui/settings"]
-margin_left = 690.0
-margin_top = 620.0
-margin_right = 940.0
-margin_bottom = 677.0
-custom_styles/hover = ExtResource( 14 )
-custom_styles/pressed = ExtResource( 14 )
-custom_styles/focus = SubResource( 40 )
-custom_styles/normal = ExtResource( 15 )
-custom_fonts/font = SubResource( 42 )
-custom_colors/font_color = Color( 1, 1, 1, 1 )
-custom_colors/font_color_hover = Color( 1, 1, 1, 1 )
-custom_colors/font_color_pressed = Color( 1, 1, 1, 1 )
+[node name="ssao_low" type="Button" parent="ui/settings/ssao"]
+margin_left = 744.0
+margin_right = 1028.0
+margin_bottom = 57.0
+size_flags_horizontal = 3
 toggle_mode = true
 group = SubResource( 39 )
 text = "Low"
 
-[node name="ssao_disabled" type="Button" parent="ui/settings"]
-margin_left = 980.0
-margin_top = 620.0
-margin_right = 1230.0
-margin_bottom = 677.0
-custom_styles/hover = ExtResource( 14 )
-custom_styles/pressed = ExtResource( 14 )
-custom_styles/focus = SubResource( 43 )
-custom_styles/normal = ExtResource( 15 )
-custom_fonts/font = SubResource( 45 )
-custom_colors/font_color = Color( 1, 1, 1, 1 )
-custom_colors/font_color_hover = Color( 1, 1, 1, 1 )
-custom_colors/font_color_pressed = Color( 1, 1, 1, 1 )
+[node name="ssao_disabled" type="Button" parent="ui/settings/ssao"]
+margin_left = 1058.0
+margin_right = 1342.0
+margin_bottom = 57.0
+size_flags_horizontal = 3
 toggle_mode = true
 group = SubResource( 39 )
 text = "Disabled"
 
-[node name="resolution_label" type="Label" parent="ui/settings"]
-margin_left = 30.0
-margin_top = 730.0
-margin_right = 368.0
-margin_bottom = 783.0
-custom_fonts/font = SubResource( 35 )
+[node name="resolution" type="HBoxContainer" parent="ui/settings"]
+margin_top = 261.0
+margin_right = 1342.0
+margin_bottom = 318.0
+custom_constants/separation = 30
+__meta__ = {
+"_edit_group_": true
+}
+
+[node name="resolution_label" type="Label" parent="ui/settings/resolution"]
+margin_top = 2.0
+margin_right = 400.0
+margin_bottom = 55.0
+rect_min_size = Vector2( 400, 0 )
 custom_colors/font_color = Color( 1, 1, 1, 1 )
 text = "Resolution:"
+__meta__ = {
+"_edit_use_anchors_": false
+}
 
-[node name="resolution_native" type="Button" parent="ui/settings"]
-margin_left = 400.0
-margin_top = 730.0
-margin_right = 650.0
-margin_bottom = 787.0
-custom_styles/hover = ExtResource( 14 )
-custom_styles/pressed = ExtResource( 14 )
-custom_styles/focus = SubResource( 36 )
-custom_styles/normal = ExtResource( 15 )
-custom_fonts/font = SubResource( 38 )
-custom_colors/font_color = Color( 1, 1, 1, 1 )
-custom_colors/font_color_hover = Color( 1, 1, 1, 1 )
-custom_colors/font_color_pressed = Color( 1, 1, 1, 1 )
+[node name="resolution_native" type="Button" parent="ui/settings/resolution"]
+margin_left = 430.0
+margin_right = 635.0
+margin_bottom = 57.0
+size_flags_horizontal = 3
 toggle_mode = true
 pressed = true
 group = SubResource( 46 )
 text = "Native"
 
-[node name="resolution_1080" type="Button" parent="ui/settings"]
-margin_left = 690.0
-margin_top = 730.0
-margin_right = 940.0
-margin_bottom = 787.0
-custom_styles/hover = ExtResource( 14 )
-custom_styles/pressed = ExtResource( 14 )
-custom_styles/focus = SubResource( 36 )
-custom_styles/normal = ExtResource( 15 )
-custom_fonts/font = SubResource( 38 )
-custom_colors/font_color = Color( 1, 1, 1, 1 )
-custom_colors/font_color_hover = Color( 1, 1, 1, 1 )
-custom_colors/font_color_pressed = Color( 1, 1, 1, 1 )
+[node name="resolution_1080" type="Button" parent="ui/settings/resolution"]
+margin_left = 665.0
+margin_right = 870.0
+margin_bottom = 57.0
+size_flags_horizontal = 3
 toggle_mode = true
 group = SubResource( 46 )
 text = "1080"
 
-[node name="resolution_720" type="Button" parent="ui/settings"]
-margin_left = 980.0
-margin_top = 730.0
-margin_right = 1230.0
-margin_bottom = 787.0
-custom_styles/hover = ExtResource( 14 )
-custom_styles/pressed = ExtResource( 14 )
-custom_styles/focus = SubResource( 36 )
-custom_styles/normal = ExtResource( 15 )
-custom_fonts/font = SubResource( 38 )
-custom_colors/font_color = Color( 1, 1, 1, 1 )
-custom_colors/font_color_hover = Color( 1, 1, 1, 1 )
-custom_colors/font_color_pressed = Color( 1, 1, 1, 1 )
+[node name="resolution_720" type="Button" parent="ui/settings/resolution"]
+margin_left = 900.0
+margin_right = 1105.0
+margin_bottom = 57.0
+size_flags_horizontal = 3
 toggle_mode = true
 group = SubResource( 46 )
 text = "720"
 
-[node name="resolution_576" type="Button" parent="ui/settings"]
-margin_left = 1270.0
-margin_top = 730.0
-margin_right = 1520.0
-margin_bottom = 787.0
-custom_styles/hover = ExtResource( 14 )
-custom_styles/pressed = ExtResource( 14 )
-custom_styles/focus = SubResource( 36 )
-custom_styles/normal = ExtResource( 15 )
-custom_fonts/font = SubResource( 38 )
-custom_colors/font_color = Color( 1, 1, 1, 1 )
-custom_colors/font_color_hover = Color( 1, 1, 1, 1 )
-custom_colors/font_color_pressed = Color( 1, 1, 1, 1 )
+[node name="resolution_576" type="Button" parent="ui/settings/resolution"]
+margin_left = 1135.0
+margin_right = 1342.0
+margin_bottom = 57.0
+size_flags_horizontal = 3
 toggle_mode = true
 group = SubResource( 46 )
 text = "576"
 
-[node name="apply" type="Button" parent="ui/settings"]
-margin_left = 400.0
-margin_top = 930.0
-margin_right = 650.0
-margin_bottom = 987.0
-custom_styles/hover = ExtResource( 14 )
-custom_styles/pressed = ExtResource( 14 )
-custom_styles/focus = SubResource( 47 )
-custom_styles/normal = SubResource( 48 )
+[node name="fullscreen" type="HBoxContainer" parent="ui/settings"]
+margin_top = 348.0
+margin_right = 1342.0
+margin_bottom = 405.0
+custom_constants/separation = 30
+
+[node name="fullscreen_label" type="Label" parent="ui/settings/fullscreen"]
+margin_top = 2.0
+margin_right = 400.0
+margin_bottom = 55.0
+rect_min_size = Vector2( 400, 0 )
+custom_colors/font_color = Color( 1, 1, 1, 1 )
+text = "Fullscreen"
+__meta__ = {
+"_edit_use_anchors_": false
+}
+
+[node name="fullscreen_yes" type="Button" parent="ui/settings/fullscreen"]
+margin_left = 430.0
+margin_right = 871.0
+margin_bottom = 57.0
+size_flags_horizontal = 3
+toggle_mode = true
+pressed = true
+group = SubResource( 53 )
+text = "Yes"
+
+[node name="fullscreen_no" type="Button" parent="ui/settings/fullscreen"]
+margin_left = 901.0
+margin_right = 1342.0
+margin_bottom = 57.0
+size_flags_horizontal = 3
+toggle_mode = true
+group = SubResource( 53 )
+text = "No"
+
+[node name="sep" type="Control" parent="ui/settings"]
+margin_top = 435.0
+margin_right = 1342.0
+margin_bottom = 455.0
+rect_min_size = Vector2( 0, 20 )
+
+[node name="actions" type="HBoxContainer" parent="ui/settings"]
+margin_top = 485.0
+margin_right = 1342.0
+margin_bottom = 542.0
+custom_constants/separation = 50
+
+[node name="apply" type="Button" parent="ui/settings/actions"]
+margin_right = 646.0
+margin_bottom = 57.0
+size_flags_horizontal = 3
+custom_styles/hover = ExtResource( 18 )
+custom_styles/pressed = ExtResource( 18 )
 custom_fonts/font = SubResource( 50 )
 custom_colors/font_color = Color( 1, 1, 1, 1 )
 custom_colors/font_color_hover = Color( 1, 1, 1, 1 )
 custom_colors/font_color_pressed = Color( 1, 1, 1, 1 )
 text = "Apply"
+__meta__ = {
+"_edit_use_anchors_": false
+}
 
-[node name="cancel" type="Button" parent="ui/settings"]
-margin_left = 980.0
-margin_top = 920.0
-margin_right = 1230.0
-margin_bottom = 977.0
-custom_styles/hover = ExtResource( 14 )
-custom_styles/pressed = ExtResource( 14 )
-custom_styles/focus = SubResource( 47 )
-custom_styles/normal = SubResource( 48 )
+[node name="cancel" type="Button" parent="ui/settings/actions"]
+margin_left = 696.0
+margin_right = 1342.0
+margin_bottom = 57.0
+size_flags_horizontal = 3
+custom_styles/hover = ExtResource( 18 )
+custom_styles/pressed = ExtResource( 18 )
 custom_fonts/font = SubResource( 50 )
 custom_colors/font_color = Color( 1, 1, 1, 1 )
 custom_colors/font_color_hover = Color( 1, 1, 1, 1 )
@@ -680,8 +550,8 @@ one_shot = true
 [connection signal="pressed" from="ui/main/play" to="." method="_on_play_pressed"]
 [connection signal="pressed" from="ui/main/settings" to="." method="_on_settings_pressed"]
 [connection signal="pressed" from="ui/main/quit" to="." method="_on_quit_pressed"]
-[connection signal="pressed" from="ui/settings/apply" to="." method="_on_apply_pressed"]
-[connection signal="pressed" from="ui/settings/cancel" to="." method="_on_cancel_pressed"]
+[connection signal="pressed" from="ui/settings/actions/apply" to="." method="_on_apply_pressed"]
+[connection signal="pressed" from="ui/settings/actions/cancel" to="." method="_on_cancel_pressed"]
 [connection signal="timeout" from="ui/loading/loading_done_timer" to="." method="_on_loading_done_timer_timeout"]
 
 [editable path="Scene Root"]

+ 5 - 2
menu/settings.gd

@@ -30,6 +30,7 @@ var gi_quality = GIQuality.LOW
 var aa_quality = AAQuality.AA_2X
 var ssao_quality = SSAOQuality.DISABLED
 var resolution = Resolution.NATIVE
+var fullscreen = true
 
 func _ready():
 	load_settings()
@@ -58,11 +59,13 @@ func load_settings():
 	if "resolution" in d:
 		resolution = int(d.resolution)
 
+	if "fullscreen" in d:
+		fullscreen = bool(d.fullscreen)
 
 func save_settings():
 	var f = File.new()
 	var error = f.open("user://settings.json", File.WRITE)
 	assert(not error)
-	
-	var d = { "gi":gi_quality, "aa":aa_quality, "ssao":ssao_quality, "resolution":resolution }
+
+	var d = { "gi":gi_quality, "aa":aa_quality, "ssao":ssao_quality, "resolution":resolution, "fullscreen":fullscreen }
 	f.store_line(to_json(d))

+ 0 - 3
player/player.gd

@@ -166,6 +166,3 @@ func _physics_process(delta):
 func _input(event):
 	if event is InputEventMouseMotion:
 		rotate_camera(event.relative * CAMERA_MOUSE_ROTATION_SPEED)
-	
-	if event.is_action_pressed("quit"):
-		get_tree().quit()

+ 7 - 1
project.godot

@@ -16,7 +16,7 @@ _global_script_class_icons={
 [application]
 
 config/name="Godot Third-Person Shooter Demo"
-run/main_scene="res://menu/menu.tscn"
+run/main_scene="res://main/main.tscn"
 config/icon="res://icon.png"
 
 [autoload]
@@ -179,6 +179,12 @@ view_down={
 "events": [ Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":3,"axis_value":-1.0,"script":null)
  ]
 }
+toggle_fullscreen={
+"deadzone": 0.5,
+"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":true,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777221,"unicode":0,"echo":false,"script":null)
+, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777254,"unicode":0,"echo":false,"script":null)
+ ]
+}
 
 [physics]