UI and other changes
This commit is contained in:
parent
87b5c11fcf
commit
215e24e246
79 changed files with 70023 additions and 2201 deletions
|
|
@ -6,7 +6,9 @@ extends RefCounted
|
|||
## * Controls: the dead zones of the move stick (the move_* actions) and the aim stick
|
||||
## (GameConfig.aim_dead_zone). Mouse aim follows the cursor directly, so it has no
|
||||
## sensitivity to set.
|
||||
## * Display: fullscreen, VSync, and the 3D resolution scale (the HUD stays sharp).
|
||||
## * Display: fullscreen, VSync, the pixel size (the 3D view renders that many times smaller
|
||||
## and scales back up with sharp pixels, for ToonLook's pixel-art look; 1 = off), and the 3D
|
||||
## resolution scale, used when the pixel size is 1 (the HUD stays sharp either way).
|
||||
## * Gameplay: whether the tips show on the first day and night (Tutorial).
|
||||
## * Co-op: your player name, and whether your microphone is sent in voice chat.
|
||||
## Values missing from the file or out of range fall back to the defaults, so an old or
|
||||
|
|
@ -17,12 +19,14 @@ const BUSES: Array[String] = ["Master", "Music", "SFX", "Ambience", "Voice"]
|
|||
const BUS_NAMES := {"Master": "Master volume", "Music": "Music and stingers", "SFX": "Sound effects", "Ambience": "Ambience",
|
||||
"Voice": "Voice chat (your friend)"}
|
||||
const DEFAULT_VOLUME := {"Master": 0.8, "Music": 0.7, "SFX": 0.8, "Ambience": 0.6, "Voice": 1.0}
|
||||
const MAX_PIXEL_SIZE := 8
|
||||
|
||||
var volume := DEFAULT_VOLUME.duplicate()
|
||||
var move_dead_zone := 0.2
|
||||
var aim_dead_zone := 0.3
|
||||
var fullscreen := false
|
||||
var vsync := true
|
||||
var pixel_size := 4
|
||||
var resolution_scale := 1.0
|
||||
var show_tips := true
|
||||
## Co-op: your name for the lobby and the name tag, and whether your microphone is sent.
|
||||
|
|
@ -41,6 +45,7 @@ static func load_from(path: String = PATH) -> GameSettings:
|
|||
g.aim_dead_zone = _number(f.get_value("controls", "aim_dead_zone", g.aim_dead_zone), 0.05, 0.9, g.aim_dead_zone)
|
||||
g.fullscreen = _flag(f.get_value("display", "fullscreen", g.fullscreen), g.fullscreen)
|
||||
g.vsync = _flag(f.get_value("display", "vsync", g.vsync), g.vsync)
|
||||
g.pixel_size = roundi(_number(f.get_value("display", "pixel_size", g.pixel_size), 1.0, MAX_PIXEL_SIZE, g.pixel_size))
|
||||
g.resolution_scale = _number(f.get_value("display", "resolution_scale", g.resolution_scale), 0.5, 1.0, g.resolution_scale)
|
||||
g.show_tips = _flag(f.get_value("gameplay", "show_tips", g.show_tips), g.show_tips)
|
||||
var n: Variant = f.get_value("coop", "player_name", "")
|
||||
|
|
@ -57,6 +62,7 @@ func save_to(path: String = PATH) -> Error:
|
|||
f.set_value("controls", "aim_dead_zone", aim_dead_zone)
|
||||
f.set_value("display", "fullscreen", fullscreen)
|
||||
f.set_value("display", "vsync", vsync)
|
||||
f.set_value("display", "pixel_size", pixel_size)
|
||||
f.set_value("display", "resolution_scale", resolution_scale)
|
||||
f.set_value("gameplay", "show_tips", show_tips)
|
||||
f.set_value("coop", "player_name", player_name)
|
||||
|
|
@ -80,7 +86,7 @@ func apply(viewport: Viewport, config: GameConfig = null) -> void:
|
|||
if config != null:
|
||||
config.aim_dead_zone = aim_dead_zone
|
||||
if viewport != null:
|
||||
viewport.scaling_3d_scale = resolution_scale
|
||||
apply_pixels(viewport)
|
||||
if DisplayServer.get_name() == "headless":
|
||||
return
|
||||
var mode := DisplayServer.window_get_mode()
|
||||
|
|
@ -91,6 +97,20 @@ func apply(viewport: Viewport, config: GameConfig = null) -> void:
|
|||
DisplayServer.window_set_vsync_mode(DisplayServer.VSYNC_ENABLED if vsync else DisplayServer.VSYNC_DISABLED)
|
||||
|
||||
|
||||
## The 3D view's size: pixel_size > 1 renders it that many times smaller with sharp (nearest)
|
||||
## upscaling and no MSAA, so each art pixel is a clean block; 1 renders it at resolution_scale
|
||||
## with the project's MSAA.
|
||||
func apply_pixels(viewport: Viewport) -> void:
|
||||
if pixel_size > 1:
|
||||
viewport.scaling_3d_mode = Viewport.SCALING_3D_MODE_NEAREST
|
||||
viewport.scaling_3d_scale = 1.0 / pixel_size
|
||||
viewport.msaa_3d = Viewport.MSAA_DISABLED
|
||||
else:
|
||||
viewport.scaling_3d_mode = Viewport.SCALING_3D_MODE_BILINEAR
|
||||
viewport.scaling_3d_scale = resolution_scale
|
||||
viewport.msaa_3d = ProjectSettings.get_setting("rendering/anti_aliasing/quality/msaa_3d", Viewport.MSAA_DISABLED)
|
||||
|
||||
|
||||
static func _number(v: Variant, lo: float, hi: float, fallback: float) -> float:
|
||||
if not (v is float or v is int):
|
||||
return fallback
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue