diff options
| author | tpart <tpart120@proton.me> | 2024-08-31 13:24:54 +0200 | 
|---|---|---|
| committer | tpart <tpart120@proton.me> | 2024-08-31 13:24:54 +0200 | 
| commit | 2f7908912ec9779c8c84358aaafceadaa944acb9 (patch) | |
| tree | d2c8bccca864f2eee556c2ccba073dd542d0e6ee | |
| parent | 260b29c9f5c010c67fbf0b38b0aac859effb46f1 (diff) | |
| download | hurrycurry-2f7908912ec9779c8c84358aaafceadaa944acb9.tar hurrycurry-2f7908912ec9779c8c84358aaafceadaa944acb9.tar.bz2 hurrycurry-2f7908912ec9779c8c84358aaafceadaa944acb9.tar.zst  | |
Re-implement settings presets
| -rw-r--r-- | client/global.gd | 70 | ||||
| -rw-r--r-- | client/menu/settings.gd | 30 | ||||
| -rw-r--r-- | client/menu/settings/settings_category.gd | 4 | 
3 files changed, 53 insertions, 51 deletions
diff --git a/client/global.gd b/client/global.gd index 6d261814..401a073e 100644 --- a/client/global.gd +++ b/client/global.gd @@ -69,7 +69,40 @@ var default_settings := [  			"grass_amount": RangeSetting.new(tr("3D grass amount per grass tile"), 16 if on_high_end() else 0, 0, 32, false),  			"lq_trees": ToggleSetting.new(tr("Low-poly trees"), false if on_high_end() else true),  			"ui_blur": ToggleSetting.new(tr("Enable UI blur"), true) -		}), +		}, [ +			Preset.new(tr("Graphics"), { +				tr("Low"): { +					"ui_blur": true, +					"aa": 0, +					"ssao": false, +					"taa": false, +					"shadows": false, +					"glow": false, +					"grass_amount": 0, +					"lq_trees": true +				}, +				tr("Medium"): { +					"ui_blur": true, +					"aa": 1, +					"ssao": false, +					"taa": false, +					"shadows": true, +					"glow": false, +					"grass_amount": 0, +					"lq_trees": false +				}, +				tr("High"): { +					"ui_blur": true, +					"aa": 2, +					"ssao": true, +					"taa": false, +					"shadows": true, +					"glow": true, +					"grass_amount": 16, +					"lq_trees": false +				} +			}) +		]),  		SettingsCategory.new(tr("Audio"), "audio", {  			"master_volume": RangeSetting.new(tr("Master Volume"), 0, -30, 0),  			"music_volume": RangeSetting.new(tr("Music Volume"), 0, -30, 0), @@ -87,41 +120,6 @@ var default_settings := [  var profile: Dictionary  var settings: Dictionary -var presets: Array[Preset] = [ -	Preset.new(tr("Graphics"), { -		tr("Low"): { -			"ui_blur": false, -			"aa": 0, -			"ssao": false, -			"taa": false, -			"shadows": false, -			"glow": false, -			"grass_amount": 0, -			"lq_trees": true -		}, -		tr("Medium"): { -			"ui_blur": true, -			"aa": 1, -			"ssao": false, -			"taa": false, -			"shadows": true, -			"glow": false, -			"grass_amount": 0, -			"lq_trees": false -		}, -		tr("High"): { -			"ui_blur": true, -			"aa": 2, -			"ssao": true, -			"taa": false, -			"shadows": true, -			"glow": true, -			"grass_amount": 16, -			"lq_trees": false -		} -	}) -] -  var server_url = ""  var error_message = "" diff --git a/client/menu/settings.gd b/client/menu/settings.gd index 93155a93..79043564 100644 --- a/client/menu/settings.gd +++ b/client/menu/settings.gd @@ -33,20 +33,7 @@ func exit():  func update_rows(fix_focus = false):  	for c in settings_tabs.get_children():  		c.queue_free() - -#	TODO: Re-implement presets in new system -#	for i in Global.presets: -#		var label := Label.new() -#		label.text = i.label -#		var hbox := HBoxContainer.new() -#		var spacer := Control.new() -#		spacer.size_flags_horizontal = Control.SIZE_EXPAND -#		hbox.add_child(label) -#		hbox.add_child(spacer) -#		options.add_child(hbox) -#		for b in i.buttons(): -#			hbox.add_child(b)  - +	  	for category: SettingsCategory in Global.default_settings:  		var category_settings = category.settings  		var scroll := ScrollContainerCustom.new() @@ -56,6 +43,21 @@ func update_rows(fix_focus = false):  		settings_tabs.add_child(scroll)  		options.size_flags_horizontal = Control.SIZE_EXPAND_FILL  		scroll.add_child(options) +		 +		var category_presets = category.presets +		if category_presets != null: +			for i in category_presets: +				var label := Label.new() +				label.text = i.label +				var hbox := HBoxContainer.new() +				var spacer := Control.new() +				spacer.size_flags_horizontal = Control.SIZE_EXPAND +				hbox.add_child(label) +				hbox.add_child(spacer) +				options.add_child(hbox) +				for b in i.buttons(): +					hbox.add_child(b) +		  		for k: String in category_settings.keys():  			var row: SettingsRow = Global.settings[k].get_row()  			options.add_child(row) diff --git a/client/menu/settings/settings_category.gd b/client/menu/settings/settings_category.gd index e3c2ac09..c4601429 100644 --- a/client/menu/settings/settings_category.gd +++ b/client/menu/settings/settings_category.gd @@ -19,8 +19,10 @@ extends Object  var name: String  var id: String  var settings: Dictionary # Dictionary[String, GameSetting] +var presets # Array[Preset] | null -func _init(new_name: String, new_id: String, new_settings: Dictionary): +func _init(new_name: String, new_id: String, new_settings: Dictionary, new_presets = null):  	name = new_name  	id = new_id  	settings = new_settings +	presets = new_presets   |