diff options
| author | tpart <tpart120@proton.me> | 2024-09-07 00:49:22 +0200 | 
|---|---|---|
| committer | tpart <tpart120@proton.me> | 2024-09-07 00:49:22 +0200 | 
| commit | fd737a6399cd201f5f3a22df5db27fac095e63bf (patch) | |
| tree | 058569a158b213589a0cd06886c9e5a87fbd4910 /client/settings.gd | |
| parent | ad0630639977a7d14700cc2958b9aad52889a298 (diff) | |
| download | hurrycurry-fd737a6399cd201f5f3a22df5db27fac095e63bf.tar hurrycurry-fd737a6399cd201f5f3a22df5db27fac095e63bf.tar.bz2 hurrycurry-fd737a6399cd201f5f3a22df5db27fac095e63bf.tar.zst | |
Add scale mode hook
Diffstat (limited to 'client/settings.gd')
| -rw-r--r-- | client/settings.gd | 21 | 
1 files changed, 10 insertions, 11 deletions
| diff --git a/client/settings.gd b/client/settings.gd index 662fb280..cb8f9cf0 100644 --- a/client/settings.gd +++ b/client/settings.gd @@ -81,8 +81,8 @@ static func get_root():  		SettingsCategory.new("ui", [  			DropdownSetting.new("touch_controls", 0, ["automatic", "enabled", "disabled"]),  			DropdownSetting.new("language", "system", Global.languages.map(func(e): return e[1])), -			DropdownSetting.new("ui_scale_mode", "resize", ["resize", "disabled"]), -			RangeSetting.new("ui_scale_factor", 1. if not Global.on_mobile() else 1.5, 0.5, 1.5, 3), +			DropdownSetting.new("scale_mode", "resize", ["resize", "disabled"]), +			RangeSetting.new("scale_factor", 1. if not Global.on_mobile() else 1.5, 0.5, 1.5, 3),  		]),  		SettingsCategory.new("input",  			InputManager.input_map_to_settings(InputManager.default_input_map) @@ -103,6 +103,7 @@ static func hook_changed_init(key: String, callable: Callable):  static var change_hooks = {  	"graphics.aa": h_aa,  	"graphics.taa": h_taa, +	"ui.scale_mode": h_scale_mode,  }  static func h_aa(mode): @@ -127,19 +128,17 @@ static func h_aa(mode):  static func h_taa(enabled):  	Global.get_viewport().use_taa = enabled +static func h_scale_mode(mode: int): +	match mode: +		0: +			Global.get_tree().root.content_scale_mode = Window.CONTENT_SCALE_MODE_CANVAS_ITEMS +		1: +			Global.get_tree().root.content_scale_mode = Window.CONTENT_SCALE_MODE_DISABLED +  # func apply_settings():  # 	update_fullscreen()  # 	update_language() -# 	# Temporal Anti-aliasing - -# 	# UI scale mode -# 	match get_setting("ui_scale_mode"): -# 		0: -# 			get_tree().root.content_scale_mode = Window.CONTENT_SCALE_MODE_CANVAS_ITEMS -# 		1: -# 			get_tree().root.content_scale_mode = Window.CONTENT_SCALE_MODE_DISABLED -	  # 	# UI scale factor  # 	get_tree().root.content_scale_factor = get_setting("ui_scale_factor") | 
