mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-10 16:04:04 +00:00
08a0f74391
Arenas inherit from a new arena_base.tscn instead of restating ~40 shared lines each; only sky/ambient/glow/tint/decoration vary, exposed via new Arena exports since nested Environment properties aren't overridable through scene inheritance. Bot construction and score-keeping move onto GameMode, shared by match and spectate modes while preserving their differing GameSettings-override behavior and the HUD's score-row duck-typing. HUD instruments share a HudInstrument base for the smoothing-weight calc and angle-lerp helper. Also dedupes MAIN_MENU_SCENE_PATH into ScenePaths and documents why DIFFICULTIES tiers share one checkpoint.
69 lines
2.1 KiB
GDScript
69 lines
2.1 KiB
GDScript
extends Control
|
|
|
|
# Settings screen: a small set of player-facing video knobs on top of
|
|
# VideoSettings (the autoload holding + persisting them). Anti-aliasing
|
|
# applies immediately since it's a Viewport-wide setting; glow/brightness
|
|
# apply the next time an arena loads (see arena.gd), since they scale each
|
|
# arena's own tuned Environment values rather than something viewport-wide.
|
|
|
|
const AA_OPTIONS := [
|
|
{"name": "Off", "mode": VideoSettings.AAMode.OFF},
|
|
{"name": "FXAA", "mode": VideoSettings.AAMode.FXAA},
|
|
{"name": "MSAA 4x", "mode": VideoSettings.AAMode.MSAA},
|
|
{"name": "MSAA 4x + FXAA", "mode": VideoSettings.AAMode.MSAA_FXAA},
|
|
]
|
|
|
|
@onready var aa_dropdown: OptionButton = %AADropdown
|
|
@onready var glow_slider: HSlider = %GlowSlider
|
|
@onready var glow_value_label: Label = %GlowValueLabel
|
|
@onready var brightness_slider: HSlider = %BrightnessSlider
|
|
@onready var brightness_value_label: Label = %BrightnessValueLabel
|
|
|
|
|
|
func _ready() -> void:
|
|
aa_dropdown.clear()
|
|
var selected := 0
|
|
for i in AA_OPTIONS.size():
|
|
aa_dropdown.add_item(AA_OPTIONS[i]["name"])
|
|
if AA_OPTIONS[i]["mode"] == VideoSettings.aa_mode:
|
|
selected = i
|
|
aa_dropdown.select(selected)
|
|
|
|
glow_slider.value = VideoSettings.glow_scale
|
|
brightness_slider.value = VideoSettings.brightness
|
|
_update_glow_label()
|
|
_update_brightness_label()
|
|
|
|
|
|
func _update_glow_label() -> void:
|
|
glow_value_label.text = "%d%%" % roundi(glow_slider.value * 100.0)
|
|
|
|
|
|
func _update_brightness_label() -> void:
|
|
brightness_value_label.text = "%d%%" % roundi(brightness_slider.value * 100.0)
|
|
|
|
|
|
func _on_aa_dropdown_item_selected(index: int) -> void:
|
|
VideoSettings.aa_mode = AA_OPTIONS[index]["mode"]
|
|
VideoSettings.apply_aa()
|
|
|
|
|
|
func _on_glow_slider_value_changed(value: float) -> void:
|
|
VideoSettings.glow_scale = value
|
|
_update_glow_label()
|
|
|
|
|
|
func _on_brightness_slider_value_changed(value: float) -> void:
|
|
VideoSettings.brightness = value
|
|
_update_brightness_label()
|
|
|
|
|
|
func _on_back_pressed() -> void:
|
|
VideoSettings.save()
|
|
get_tree().change_scene_to_file(ScenePaths.MAIN_MENU)
|
|
|
|
|
|
func _unhandled_input(event: InputEvent) -> void:
|
|
if event.is_action_pressed("ui_cancel"):
|
|
_on_back_pressed()
|