diff options
author | Hop311 <Hop3114@gmail.com> | 2023-08-17 20:25:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-17 20:25:25 +0200 |
commit | aa9961b27a4859f088b037dd8037accb4e3119be (patch) | |
tree | e93af9cabfbefc6ea089a153399e04d74e4b605a /game/src/Game/Autoload/GuiScale.gd | |
parent | ff0d38b5d53fa95609f2587a2be5205f0c0d3118 (diff) | |
parent | 9a086523513994b0183d5f7d479b2f82412177f6 (diff) |
Merge pull request #146 from Nemrav/piechart2
Add Piecharts (gd 4.1)
Diffstat (limited to 'game/src/Game/Autoload/GuiScale.gd')
-rw-r--r-- | game/src/Game/Autoload/GuiScale.gd | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/game/src/Game/Autoload/GuiScale.gd b/game/src/Game/Autoload/GuiScale.gd index afd73df..d364ff5 100644 --- a/game/src/Game/Autoload/GuiScale.gd +++ b/game/src/Game/Autoload/GuiScale.gd @@ -26,7 +26,7 @@ func _ready(): func has_guiscale(guiscale_value : float) -> bool: return guiscale_value in _guiscales - + func add_guiscale(guiscale_value: float, guiscale_name: StringName=&"") -> bool: if has_guiscale(guiscale_value): return true var scale_dict := { value = guiscale_value } @@ -39,24 +39,24 @@ func add_guiscale(guiscale_value: float, guiscale_name: StringName=&"") -> bool: return false _guiscales[guiscale_value] = scale_dict return true - + #returns floats func get_guiscale_value_list() -> Array: var list := _guiscales.keys() list.sort_custom(func(a, b): return a > b) return list - + func get_guiscale_display_name(guiscale_value : float) -> StringName: return _guiscales.get(guiscale_value, {display_name = &"unknown gui scale"}).display_name func get_current_guiscale() -> float: return get_tree().root.content_scale_factor - + func set_guiscale(guiscale:float) -> void: print("New GUI scale: %f" % guiscale) if not has_guiscale(guiscale): push_warning("Setting GUI Scale to non-standard value %sx" % [guiscale]) get_tree().root.content_scale_factor = guiscale - + func reset_guiscale() -> void: set_guiscale(get_current_guiscale()) |