mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-10 16:04:04 +00:00
feat: add post-processing pass and video settings menu
Enable glow/bloom, color adjustments, and MSAA+FXAA across all three arenas so emissive ship/station accents actually bleed light and edges read cleanly. Expose the player-facing knobs (anti-aliasing mode, glow intensity, brightness) through a new Settings screen off the main menu, persisted via a VideoSettings autoload that scales each arena's own tuned Environment values on load rather than overwriting them.
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
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 MAIN_MENU_SCENE_PATH := "res://scenes/main_menu.tscn"
|
||||
|
||||
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(MAIN_MENU_SCENE_PATH)
|
||||
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("ui_cancel"):
|
||||
_on_back_pressed()
|
||||
Reference in New Issue
Block a user