diff options
author | Hop311 <hop3114@gmail.com> | 2023-05-10 21:52:46 +0200 |
---|---|---|
committer | Nemrav <50055236+Nemrav@users.noreply.github.com> | 2023-05-10 22:29:23 +0200 |
commit | 8a59cb15b58f512f27f01a71248feef4777e3a41 (patch) | |
tree | 2a9a0816b571946c7d9fb00b49fc74203101c3ab /game/src/Autoload | |
parent | df97602c6d7335d0a8c83cddefef8716e47c37a0 (diff) |
GUI scale tweaks
Diffstat (limited to 'game/src/Autoload')
-rw-r--r-- | game/src/Autoload/GuiScale.gd | 21 | ||||
-rw-r--r-- | game/src/Autoload/Resolution.gd | 14 |
2 files changed, 16 insertions, 19 deletions
diff --git a/game/src/Autoload/GuiScale.gd b/game/src/Autoload/GuiScale.gd index d134f5b..afd73df 100644 --- a/game/src/Autoload/GuiScale.gd +++ b/game/src/Autoload/GuiScale.gd @@ -1,17 +1,16 @@ extends Node -#the default value -const error_guiscale : float = 1 +const error_guiscale : float = -1.0 @export var minimum_guiscale : float = 0.1 const _starting_guiscales : Dictionary = { - float(0.5): &"0.5x", + float(0.5) : &"0.5x", float(0.75): &"0.75x", - float(1): &"1x", - float(1.5): &"1.5x", - float(2): &"2x", + float(1) : &"1x", + float(1.5) : &"1.5x", + float(2) : &"2x", } var _guiscales: Dictionary @@ -31,13 +30,12 @@ func has_guiscale(guiscale_value : float) -> bool: func add_guiscale(guiscale_value: float, guiscale_name: StringName=&"") -> bool: if has_guiscale(guiscale_value): return true var scale_dict := { value = guiscale_value } - var display_name := "%sx" % [guiscale_value] if not guiscale_name.is_empty(): - scale_dict.name = guiscale_name - #don't need to change the display name - scale_dict.display_name = StringName(display_name) + scale_dict.display_name = guiscale_name + else: + scale_dict.display_name = StringName("%sx" % guiscale_value) if guiscale_value < minimum_guiscale: - push_error("GUI scale %s is smaller than the minimum %s" % [scale_dict.display_name,minimum_guiscale]) + push_error("GUI scale %s is smaller than the minimum %s" % [scale_dict.display_name, minimum_guiscale]) return false _guiscales[guiscale_value] = scale_dict return true @@ -62,4 +60,3 @@ func set_guiscale(guiscale:float) -> void: func reset_guiscale() -> void: set_guiscale(get_current_guiscale()) - diff --git a/game/src/Autoload/Resolution.gd b/game/src/Autoload/Resolution.gd index 35ecbb3..56aa4a5 100644 --- a/game/src/Autoload/Resolution.gd +++ b/game/src/Autoload/Resolution.gd @@ -9,13 +9,13 @@ const _starting_resolutions : Dictionary = { Vector2i(3840,2160): &"4K", Vector2i(2560,1080): &"UW1080p", Vector2i(1920,1080): &"1080p", - Vector2i(1366,768): &"", - Vector2i(1536,864): &"", - Vector2i(1280,720): &"720p", - Vector2i(1440,900): &"", - Vector2i(1600,900): &"", - Vector2i(1024,600): &"", - Vector2i(800,600): &"" + Vector2i(1366,768) : &"", + Vector2i(1536,864) : &"", + Vector2i(1280,720) : &"720p", + Vector2i(1440,900) : &"", + Vector2i(1600,900) : &"", + Vector2i(1024,600) : &"", + Vector2i(800,600) : &"" } var _resolutions : Dictionary |