-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #130 from NancokPS2/expanded-options
Options menu upgrade
- Loading branch information
Showing
24 changed files
with
842 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
extends ShaderMaterial | ||
class_name ShaderMaterialColorblindnessAssist | ||
## Uses the "accessibility_colorblindness_filter" setting to automatically load the proper filter when initialized | ||
## Apply this material with "material = ShaderMaterialColorblindnessAssist.new()" | ||
## Or trough the inspector by clicking in the "material" property. | ||
|
||
|
||
const Shaders: Array[Shader] = [ | ||
null, | ||
preload("res://assets/shaders/deutranopia_colorblindness_by_Vildravn.gdshader"), | ||
preload("res://assets/shaders/protanopia_colorblindness_by_Vildravn.gdshader"), | ||
preload("res://assets/shaders/tritanopia_colorblindness_by_Vildravn.gdshader") | ||
] | ||
|
||
func _init() -> void: | ||
var shaderMode: int = LocalSaveSystem.get_data(LocalSaveSystem.Sections.SETTINGS, "accessibility_colorblindness_filter", 0) | ||
shader = Shaders[shaderMode] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
Shader sourced from: https://godotshaders.com/shader/colorblindness-correction-shader/ | ||
|
||
This shader is NOT a magical fix, but it will make things easier to distinguish in certain configurations. | ||
|
||
Colorblindness correction shader with adjustable intensity. Can correct for: | ||
* Protanopia (Greatly reduced reds) | ||
* Deuteranopia (Greatly reduced greens) | ||
* Tritanopia (Greatly reduced blues) | ||
|
||
The correction algorithm is taken from http://www.daltonize.org/search/label/Daltonize | ||
|
||
This shader is released under the CC0 license. Feel free to use, improve and change this shader and consider sharing the modified result. | ||
*/ | ||
|
||
shader_type canvas_item; | ||
|
||
// Color correction mode | ||
// 0 - Protanopia | ||
// 1 - Deutranopia | ||
// 2 - Tritanopia | ||
uniform int mode : hint_range(0, 2) = 0; | ||
|
||
uniform float intensity : hint_range(0.0, 1.0) = 1.0; | ||
|
||
uniform sampler2D SCREEN_TEXTURE : hint_screen_texture; | ||
|
||
void fragment() | ||
{ | ||
vec4 tex = texture(SCREEN_TEXTURE, SCREEN_UV); | ||
|
||
float L = (17.8824 * tex.r) + (43.5161 * tex.g) + (4.11935 * tex.b); | ||
float M = (3.45565 * tex.r) + (27.1554 * tex.g) + (3.86714 * tex.b); | ||
float S = (0.0299566 * tex.r) + (0.184309 * tex.g) + (1.46709 * tex.b); | ||
|
||
float l, m, s; | ||
if (mode == 0) //Protanopia | ||
{ | ||
l = 0.0 * L + 2.02344 * M + -2.52581 * S; | ||
m = 0.0 * L + 1.0 * M + 0.0 * S; | ||
s = 0.0 * L + 0.0 * M + 1.0 * S; | ||
} | ||
|
||
if (mode == 1) //Deuteranopia | ||
{ | ||
l = 1.0 * L + 0.0 * M + 0.0 * S; | ||
m = 0.494207 * L + 0.0 * M + 1.24827 * S; | ||
s = 0.0 * L + 0.0 * M + 1.0 * S; | ||
} | ||
|
||
if (mode == 2) //Tritanopia | ||
{ | ||
l = 1.0 * L + 0.0 * M + 0.0 * S; | ||
m = 0.0 * L + 1.0 * M + 0.0 * S; | ||
s = -0.395913 * L + 0.801109 * M + 0.0 * S; | ||
} | ||
|
||
vec4 error; | ||
error.r = (0.0809444479 * l) + (-0.130504409 * m) + (0.116721066 * s); | ||
error.g = (-0.0102485335 * l) + (0.0540193266 * m) + (-0.113614708 * s); | ||
error.b = (-0.000365296938 * l) + (-0.00412161469 * m) + (0.693511405 * s); | ||
error.a = 1.0; | ||
vec4 diff = tex - error; | ||
vec4 correction; | ||
correction.r = 0.0; | ||
correction.g = (diff.r * 0.7) + (diff.g * 1.0); | ||
correction.b = (diff.r * 0.7) + (diff.b * 1.0); | ||
correction = tex + correction; | ||
correction.a = tex.a * intensity; | ||
|
||
COLOR = correction; | ||
} |
49 changes: 49 additions & 0 deletions
49
assets/shaders/deutranopia_colorblindness_by_Vildravn.gdshader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
Shader sourced from: https://godotshaders.com/shader/colorblindness-correction-shader/ | ||
|
||
This shader is NOT a magical fix, but it will make things easier to distinguish in certain configurations. | ||
|
||
Colorblindness correction shader with adjustable intensity. Can correct for: | ||
* Protanopia (Greatly reduced reds) | ||
* Deuteranopia (Greatly reduced greens) | ||
* Tritanopia (Greatly reduced blues) | ||
|
||
The correction algorithm is taken from http://www.daltonize.org/search/label/Daltonize | ||
|
||
This shader is released under the CC0 license. Feel free to use, improve and change this shader and consider sharing the modified result. | ||
*/ | ||
|
||
shader_type canvas_item; | ||
|
||
uniform float intensity : hint_range(0.0, 1.0) = 1.0; | ||
|
||
uniform sampler2D SCREEN_TEXTURE : hint_screen_texture; | ||
|
||
void fragment() | ||
{ | ||
vec4 tex = texture(SCREEN_TEXTURE, SCREEN_UV); | ||
|
||
float L = (17.8824 * tex.r) + (43.5161 * tex.g) + (4.11935 * tex.b); | ||
float M = (3.45565 * tex.r) + (27.1554 * tex.g) + (3.86714 * tex.b); | ||
float S = (0.0299566 * tex.r) + (0.184309 * tex.g) + (1.46709 * tex.b); | ||
|
||
float l, m, s; | ||
l = 1.0 * L + 0.0 * M + 0.0 * S; | ||
m = 0.494207 * L + 0.0 * M + 1.24827 * S; | ||
s = 0.0 * L + 0.0 * M + 1.0 * S; | ||
|
||
vec4 error; | ||
error.r = (0.0809444479 * l) + (-0.130504409 * m) + (0.116721066 * s); | ||
error.g = (-0.0102485335 * l) + (0.0540193266 * m) + (-0.113614708 * s); | ||
error.b = (-0.000365296938 * l) + (-0.00412161469 * m) + (0.693511405 * s); | ||
error.a = 1.0; | ||
vec4 diff = tex - error; | ||
vec4 correction; | ||
correction.r = 0.0; | ||
correction.g = (diff.r * 0.7) + (diff.g * 1.0); | ||
correction.b = (diff.r * 0.7) + (diff.b * 1.0); | ||
correction = tex + correction; | ||
correction.a = tex.a * intensity; | ||
|
||
COLOR = correction; | ||
} |
49 changes: 49 additions & 0 deletions
49
assets/shaders/protanopia_colorblindness_by_Vildravn.gdshader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
Shader sourced from: https://godotshaders.com/shader/colorblindness-correction-shader/ | ||
|
||
This shader is NOT a magical fix, but it will make things easier to distinguish in certain configurations. | ||
|
||
Colorblindness correction shader with adjustable intensity. Can correct for: | ||
* Protanopia (Greatly reduced reds) | ||
* Deuteranopia (Greatly reduced greens) | ||
* Tritanopia (Greatly reduced blues) | ||
|
||
The correction algorithm is taken from http://www.daltonize.org/search/label/Daltonize | ||
|
||
This shader is released under the CC0 license. Feel free to use, improve and change this shader and consider sharing the modified result. | ||
*/ | ||
|
||
shader_type canvas_item; | ||
|
||
uniform float intensity : hint_range(0.0, 1.0) = 1.0; | ||
|
||
uniform sampler2D SCREEN_TEXTURE : hint_screen_texture; | ||
|
||
void fragment() | ||
{ | ||
vec4 tex = texture(SCREEN_TEXTURE, SCREEN_UV); | ||
|
||
float L = (17.8824 * tex.r) + (43.5161 * tex.g) + (4.11935 * tex.b); | ||
float M = (3.45565 * tex.r) + (27.1554 * tex.g) + (3.86714 * tex.b); | ||
float S = (0.0299566 * tex.r) + (0.184309 * tex.g) + (1.46709 * tex.b); | ||
|
||
float l, m, s; | ||
l = 0.0 * L + 2.02344 * M + -2.52581 * S; | ||
m = 0.0 * L + 1.0 * M + 0.0 * S; | ||
s = 0.0 * L + 0.0 * M + 1.0 * S; | ||
|
||
vec4 error; | ||
error.r = (0.0809444479 * l) + (-0.130504409 * m) + (0.116721066 * s); | ||
error.g = (-0.0102485335 * l) + (0.0540193266 * m) + (-0.113614708 * s); | ||
error.b = (-0.000365296938 * l) + (-0.00412161469 * m) + (0.693511405 * s); | ||
error.a = 1.0; | ||
vec4 diff = tex - error; | ||
vec4 correction; | ||
correction.r = 0.0; | ||
correction.g = (diff.r * 0.7) + (diff.g * 1.0); | ||
correction.b = (diff.r * 0.7) + (diff.b * 1.0); | ||
correction = tex + correction; | ||
correction.a = tex.a * intensity; | ||
|
||
COLOR = correction; | ||
} |
49 changes: 49 additions & 0 deletions
49
assets/shaders/tritanopia_colorblindness_by_Vildravn.gdshader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
Shader sourced from: https://godotshaders.com/shader/colorblindness-correction-shader/ | ||
|
||
This shader is NOT a magical fix, but it will make things easier to distinguish in certain configurations. | ||
|
||
Colorblindness correction shader with adjustable intensity. Can correct for: | ||
* Protanopia (Greatly reduced reds) | ||
* Deuteranopia (Greatly reduced greens) | ||
* Tritanopia (Greatly reduced blues) | ||
|
||
The correction algorithm is taken from http://www.daltonize.org/search/label/Daltonize | ||
|
||
This shader is released under the CC0 license. Feel free to use, improve and change this shader and consider sharing the modified result. | ||
*/ | ||
|
||
shader_type canvas_item; | ||
|
||
uniform float intensity : hint_range(0.0, 1.0) = 1.0; | ||
|
||
uniform sampler2D SCREEN_TEXTURE : hint_screen_texture; | ||
|
||
void fragment() | ||
{ | ||
vec4 tex = texture(SCREEN_TEXTURE, SCREEN_UV); | ||
|
||
float L = (17.8824 * tex.r) + (43.5161 * tex.g) + (4.11935 * tex.b); | ||
float M = (3.45565 * tex.r) + (27.1554 * tex.g) + (3.86714 * tex.b); | ||
float S = (0.0299566 * tex.r) + (0.184309 * tex.g) + (1.46709 * tex.b); | ||
|
||
float l, m, s; | ||
l = 1.0 * L + 0.0 * M + 0.0 * S; | ||
m = 0.0 * L + 1.0 * M + 0.0 * S; | ||
s = -0.395913 * L + 0.801109 * M + 0.0 * S; | ||
|
||
vec4 error; | ||
error.r = (0.0809444479 * l) + (-0.130504409 * m) + (0.116721066 * s); | ||
error.g = (-0.0102485335 * l) + (0.0540193266 * m) + (-0.113614708 * s); | ||
error.b = (-0.000365296938 * l) + (-0.00412161469 * m) + (0.693511405 * s); | ||
error.a = 1.0; | ||
vec4 diff = tex - error; | ||
vec4 correction; | ||
correction.r = 0.0; | ||
correction.g = (diff.r * 0.7) + (diff.g * 1.0); | ||
correction.b = (diff.r * 0.7) + (diff.b * 1.0); | ||
correction = tex + correction; | ||
correction.a = tex.a * intensity; | ||
|
||
COLOR = correction; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
extends Control | ||
|
||
@onready var chatPanel: Control = $ChatPanel | ||
|
||
|
||
func _input(event: InputEvent) -> void: | ||
if event.is_action_pressed("j_ui_toggle"): | ||
visible = !visible | ||
if event.is_action_pressed("j_ui_chat_toggle"): | ||
chatPanel.visible = !chatPanel.visible |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
extends HSlider | ||
|
||
const QualityList: Array[String] = ["Disabled", "x2", "x4", "x8"] | ||
|
||
@onready var textLabel: Label = $Label | ||
|
||
|
||
func _ready() -> void: | ||
value = LocalSaveSystem.get_data( | ||
LocalSaveSystem.Sections.SETTINGS, "graphics_antialiasing_msaa", 0 | ||
) | ||
value_changed.connect(shadow_update) | ||
shadow_update(value) | ||
|
||
|
||
func display_update(val: float): | ||
var quality: int = int(val) | ||
textLabel.text = QualityList[quality] | ||
|
||
|
||
func shadow_update(newValue: float): | ||
var quality: int = int(newValue) | ||
ProjectSettings.set_setting("rendering/anti_aliasing/quality/msaa_2d", quality) | ||
ProjectSettings.set_setting("rendering/anti_aliasing/quality/msaa_3d", quality) | ||
|
||
LocalSaveSystem.set_data( | ||
LocalSaveSystem.Sections.SETTINGS, "graphics_antialiasing_msaa", newValue | ||
) | ||
display_update(newValue) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
extends OptionButton | ||
## This setting is used by "res://assets/shaders/colorblindness_assistance_material.gd" | ||
|
||
const FilterSettings: Array[String] = ["Disabled", "Deutranopia", "Protanopia", "Tritanopia"] | ||
|
||
|
||
func _init() -> void: | ||
#There must be as many settings as there are Shaders | ||
assert(ShaderMaterialColorblindnessAssist.Shaders.size() == FilterSettings.size()) | ||
for setting in FilterSettings: | ||
add_item(setting) | ||
|
||
|
||
func _ready() -> void: | ||
var setting: int = LocalSaveSystem.get_data( | ||
LocalSaveSystem.Sections.SETTINGS, "accessibility_colourblindness_filter", 0 | ||
) | ||
item_selected.connect(filter_update) | ||
display_update(setting) | ||
|
||
|
||
func display_update(id: int): | ||
text = str(FilterSettings[id]) | ||
selected = id | ||
|
||
|
||
func filter_update(id: int): | ||
LocalSaveSystem.set_data( | ||
LocalSaveSystem.Sections.SETTINGS, "accessibility_colourblindness_filter", id | ||
) | ||
display_update(id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
extends HSlider | ||
|
||
@onready var textLabel: Label = $Label | ||
|
||
|
||
func _ready() -> void: | ||
value = LocalSaveSystem.get_data(LocalSaveSystem.Sections.SETTINGS, "graphics_fps_limit", 60) | ||
value_changed.connect(fps_update) | ||
display_update(value) | ||
|
||
|
||
func display_update(val: float): | ||
var fps: int = int(val) | ||
if fps == max_value: | ||
textLabel.text = "Unlimited" | ||
else: | ||
textLabel.text = str(fps) | ||
|
||
|
||
func fps_update(newValue: float): | ||
var fps: int = int(newValue) | ||
|
||
if newValue == max_value: | ||
Engine.max_fps = 0 | ||
else: | ||
Engine.max_fps = fps | ||
|
||
display_update(newValue) | ||
|
||
LocalSaveSystem.set_data(LocalSaveSystem.Sections.SETTINGS, "graphics_fps_limit", fps) |
Oops, something went wrong.