A13: Gamepad and accessibility
Gamepad: PadInput reads pad events in one fixed layout (sticks move and look, triggers aim and fire, bumpers step slots and build pieces, Start pauses), fed through ClientInput alongside the keys and mouse. Menus take South to choose and East or Start to go back. The tutorial names pad buttons once the pad is used. Aim assist (option, on by default, pad only): friction across an opponent in plain sight near the look, and a pull of at most 9 deg/s while aiming. Client look only; never through cover. Accessibility (new Access tab): colour-vision sets for the signal colours (red-green, blue-yellow), checked by simulated colour vision in test_palette; interface size 90-130%, with the HUD hotbar refitting at the larger sizes; captions for key sounds with direction; reduce motion (calmer aim zoom and hurt flash). Tests for the pad, aim assist, captions, palettes, settings, the menus driven from a pad, and a pad playing through a real offline session. make access-captures renders the new screens and options. Closes #53 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -209,3 +209,70 @@ func test_renderer_fallback_notice() -> void:
|
||||
assert_eq(RendererCheck.notice_for("forward_plus", "gl_compatibility", PackedStringArray(["--rendering-method", "gl_compatibility"])), "", "the player chose OpenGL")
|
||||
assert_eq(RendererCheck.notice_for("forward_plus", "gl_compatibility", PackedStringArray(["--rendering-driver=opengl3"])), "", "the player chose OpenGL")
|
||||
assert_eq(RendererCheck.fallback_notice(), "", "nothing to say headless")
|
||||
|
||||
|
||||
func test_gamepad_and_accessibility_round_trip_and_fall_back() -> void:
|
||||
var settings: GameSettings = GameSettings.new()
|
||||
assert_true(settings.mouse.aim_assist, "aim assist starts on")
|
||||
assert_false(settings.captions)
|
||||
assert_false(settings.reduce_motion)
|
||||
settings.mouse.pad_sensitivity = 1.75
|
||||
settings.mouse.aim_assist = false
|
||||
settings.vision = Palette.VISION_RED_GREEN
|
||||
settings.ui_scale = 1.15
|
||||
settings.captions = true
|
||||
settings.reduce_motion = true
|
||||
assert_eq(settings.save(PATH), OK)
|
||||
var loaded: GameSettings = GameSettings.load_from(PATH)
|
||||
assert_near(loaded.mouse.pad_sensitivity, 1.75, 0.0001)
|
||||
assert_false(loaded.mouse.aim_assist)
|
||||
assert_eq(loaded.vision, Palette.VISION_RED_GREEN)
|
||||
assert_eq(loaded.ui_scale, 1.15)
|
||||
assert_true(loaded.captions)
|
||||
assert_true(loaded.reduce_motion)
|
||||
var config: ConfigFile = ConfigFile.new()
|
||||
config.set_value("access", "vision", 42)
|
||||
config.set_value("access", "ui_scale", 7.0)
|
||||
config.set_value("access", "captions", "yes")
|
||||
config.set_value("input", "pad_sensitivity", 99.0)
|
||||
config.set_value("input", "aim_assist", 3)
|
||||
config.save(PATH)
|
||||
loaded = GameSettings.load_from(PATH)
|
||||
assert_eq(loaded.vision, Palette.VISION_NAMES.size() - 1, "clamped")
|
||||
assert_eq(loaded.ui_scale, 1.0, "a scale not offered is the default")
|
||||
assert_false(loaded.captions)
|
||||
assert_near(loaded.mouse.pad_sensitivity, InputSettings.MAX_PAD_SENSITIVITY, 0.0001)
|
||||
assert_true(loaded.mouse.aim_assist)
|
||||
|
||||
|
||||
func test_applying_sets_the_colour_vision_and_interface_size() -> void:
|
||||
var tree: SceneTree = Engine.get_main_loop() as SceneTree
|
||||
var settings: GameSettings = GameSettings.new()
|
||||
settings.vision = Palette.VISION_BLUE_YELLOW
|
||||
settings.ui_scale = 1.3
|
||||
settings.apply_to_program(tree)
|
||||
assert_eq(Palette.vision, Palette.VISION_BLUE_YELLOW)
|
||||
assert_near(tree.root.content_scale_factor, 1.3, 0.0001)
|
||||
GameSettings.new().apply_to_program(tree)
|
||||
assert_eq(Palette.vision, Palette.VISION_STANDARD)
|
||||
assert_near(tree.root.content_scale_factor, 1.0, 0.0001)
|
||||
|
||||
|
||||
func test_reduce_motion_calms_the_aim_zoom() -> void:
|
||||
var rig: CameraRig = CameraRig.new()
|
||||
rig.update_aim(true, 0.1)
|
||||
var quick: float = rig.aim_blend
|
||||
rig.aim_blend = 1.0
|
||||
var full_zoom: float = rig.fov()
|
||||
var calm: CameraRig = CameraRig.new()
|
||||
calm.reduce_motion = true
|
||||
calm.update_aim(true, 0.1)
|
||||
assert_true(calm.aim_blend < quick, "eases in more slowly")
|
||||
calm.aim_blend = 1.0
|
||||
assert_true(calm.fov() > full_zoom + 10.0, "zooms in less: %.0f against %.0f" % [calm.fov(), full_zoom])
|
||||
var view: MatchView = MatchView.new()
|
||||
var settings: GameSettings = GameSettings.new()
|
||||
settings.reduce_motion = true
|
||||
view.apply_settings(settings)
|
||||
assert_true(view.rig.reduce_motion)
|
||||
view.free()
|
||||
|
||||
Reference in New Issue
Block a user