implement rest of options, including CRT/LCD filter!

This commit is contained in:
Haze Weathers 2024-02-27 22:35:28 -05:00
parent e0e56d3ffa
commit 2da5935c3b
4 changed files with 31 additions and 12 deletions

View file

@ -95,14 +95,19 @@ func save_options() -> void:
var file = ConfigFile.new()
#Game
file.set_value("game", "rumble", rumble)
file.set_value("game", "gore", gore)
#Video
file.set_value("video", "fullscreen", fullscreen)
file.set_value("video", "window_size", window_size)
file.set_value("video", "scaling_mode", scaling_mode)
file.set_value("video", "transition_speed", transition_speed)
file.set_value("video", "border", border)
file.set_value("video", "scanlines", scanlines)
#Audio
file.set_value("audio", "master_volume", master_volume)
file.set_value("audio", "music_volume", music_volume)
file.set_value("audio", "sound_volume", sound_volume)
file.set_value("audio", "landing_sound", landing_sound)
# last played file
file.set_value("save", "last_file", last_file)
# save the options to file
@ -116,7 +121,8 @@ func _set_fullscreen(value: bool) -> void:
OS.window_fullscreen = fullscreen
func _set_window_size(value: float) -> void:
pass
window_size = value
OS.window_size = Game.RESOLUTION * window_size
func _set_scaling_mode(value: int) -> void:
scaling_mode = value
@ -134,7 +140,8 @@ func _set_border(value: int) -> void:
Border.current_border = border
func _set_scanlines(value: int) -> void:
pass
scanlines = value
SceneManager.set_scanlines(scanlines)
# audio setters

View file

@ -32,6 +32,20 @@ func change_scene(new_scene: Node) -> void:
viewport.call_deferred("add_child", new_scene)
current_scene = new_scene
func set_scanlines(type: int) -> void:
yield(get_tree(), "idle_frame")
match type:
Options.ScanlineType.NONE:
viewport_container.material.set_shader_param("enabled", false)
Options.ScanlineType.CRT:
viewport_container.material.set_shader_param("enabled", true)
viewport_container.material.set_shader_param("scanline_opacity", Vector2(0.2, 0.0))
viewport_container.material.set_shader_param("brightness", 1.1)
Options.ScanlineType.LCD:
viewport_container.material.set_shader_param("enabled", true)
viewport_container.material.set_shader_param("scanline_opacity", Vector2(0.2, 0.2))
viewport_container.material.set_shader_param("brightness", 1.2)
func _ready() -> void:
var tree := get_tree()
# capture initial scene

View file

@ -8,7 +8,7 @@ shader = ExtResource( 2 )
shader_param/enabled = false
shader_param/resolution = Vector2( 256, 192 )
shader_param/curvature = Vector2( 0, 0 )
shader_param/scanline_opacity = Vector2( 0.2, 0.2 )
shader_param/scanline_opacity = Vector2( 0.2, 0 )
shader_param/brightness = 1.0
[node name="SceneManager" type="Node"]

View file

@ -16,5 +16,3 @@ func _gui_input(event):
Audio.ac_music.stop()
current_selection = posmod(current_selection,sounds.size())
body.text = titles[current_selection]