40 lines
1.3 KiB
GDScript
40 lines
1.3 KiB
GDScript
extends Node
|
|
|
|
@export var game_scene : Resource
|
|
@export var settings_scene : Resource
|
|
@export var default_focus : Control
|
|
@export var autostart_animations : Array[NodePath]
|
|
|
|
# Engine Callbackss
|
|
func _ready():
|
|
GlobalSettings.set_controls_from_save_file()
|
|
GlobalSettings.set_display_mode(Save.game_data.display_mode)
|
|
GlobalSettings.toggle_vsync(Save.game_data.vsync_on)
|
|
GlobalSettings.set_resolution(Save.game_data.current_resolution_index)
|
|
DisplayServer.window_set_min_size(Vector2(640,480))
|
|
GlobalSettings.update_master_volume(Save.game_data.master_volume)
|
|
GlobalSettings.update_music_volume(Save.game_data.music_volume)
|
|
GlobalSettings.update_sfx_volume(Save.game_data.sfx_volume)
|
|
default_focus.grab_focus()
|
|
for animation in autostart_animations:
|
|
(get_node(animation) as AnimationPlayer).play("Autostart")
|
|
pass
|
|
|
|
func _on_play_button_pressed():
|
|
load(game_scene.resource_path)
|
|
get_tree().change_scene_to_file(game_scene.resource_path)
|
|
pass
|
|
|
|
func _on_settings_button_pressed():
|
|
var settings_scene_instance = load(settings_scene.resource_path).instantiate()
|
|
settings_scene_instance.on_back = Callable(func(): default_focus.grab_focus())
|
|
get_tree().current_scene.add_child(settings_scene_instance)
|
|
pass
|
|
|
|
func _on_about_button_pressed():
|
|
OS.shell_open("https://git.euph.dev/GameDev/HoppyEaster")
|
|
pass
|
|
|
|
func _on_quit_button_pressed():
|
|
get_tree().quit()
|
|
pass
|