a game about throwing hammers made for the github game off
Diffstat (limited to 'ui/graphics.gd')
| -rw-r--r-- | ui/graphics.gd | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/ui/graphics.gd b/ui/graphics.gd index 3bec0e1..15c7de0 100644 --- a/ui/graphics.gd +++ b/ui/graphics.gd @@ -5,12 +5,12 @@ const SaveLoad := preload("res://addons/remap/private/SaveLoadUtils.gd") # so wh enum {FULLSCREEN, BORDERLESS_FS, WINDOWED} const map := { - FULLSCREEN: DisplayServer.WINDOW_MODE_FULLSCREEN, - WINDOWED: DisplayServer.WINDOW_MODE_WINDOWED, + FULLSCREEN: DisplayServer.WINDOW_MODE_FULLSCREEN, + WINDOWED: DisplayServer.WINDOW_MODE_WINDOWED, } const default_settings_data := { - window = WINDOWED, - vsync = false, + window = WINDOWED, + vsync = false, } @onready var vsync: CheckBox = $"%vsyncbutton" @@ -22,41 +22,41 @@ var has_loaded := false var settings := default_settings_data func save() -> void: - SaveLoad.save(file, settings) + SaveLoad.save(file, settings) func _ready() -> void: - var lod := SaveLoad.load_file(file) - settings = lod if Util.dict_cmp(lod, default_settings_data) else default_settings_data # check if the keys and vaue types are correct - has_loaded = true - update_button_visuals() + var lod := SaveLoad.load_file(file) + settings = lod if Util.dict_cmp(lod, default_settings_data) else default_settings_data # check if the keys and vaue types are correct + has_loaded = true + update_button_visuals() func update_button_visuals(): - ignore_set_settings = true - vsync.button_pressed = settings.vsync - window.current_option = settings.window - ignore_set_settings = false + ignore_set_settings = true + vsync.button_pressed = settings.vsync + window.current_option = settings.window + ignore_set_settings = false func update_window(): - if settings.window == BORDERLESS_FS: - DisplayServer.window_set_mode(map[FULLSCREEN]) - DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_BORDERLESS, true) - else: - DisplayServer.window_set_mode(map[settings.window]) + if settings.window == BORDERLESS_FS: + DisplayServer.window_set_mode(map[FULLSCREEN]) + DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_BORDERLESS, true) + else: + DisplayServer.window_set_mode(map[settings.window]) func update_vsync(): - var vsync_mode := DisplayServer.VSYNC_DISABLED if not settings.vsync else DisplayServer.VSYNC_ENABLED - DisplayServer.window_set_vsync_mode(vsync_mode) + var vsync_mode := DisplayServer.VSYNC_DISABLED if not settings.vsync else DisplayServer.VSYNC_ENABLED + DisplayServer.window_set_vsync_mode(vsync_mode) func _on_vsync_toggled(button_pressed: bool) -> void: - if not has_loaded: return - if not ignore_set_settings: - settings.vsync = button_pressed - save() - update_vsync() + if not has_loaded: return + if not ignore_set_settings: + settings.vsync = button_pressed + save() + update_vsync() func _on_window_mode_changed(current_option: int) -> void: - if not has_loaded: return - if not ignore_set_settings: - settings.window = current_option - save() - update_window() + if not has_loaded: return + if not ignore_set_settings: + settings.window = current_option + save() + update_window() |