Expand description
Validated live presentation settings, separate from persistence and simulation.
try_apply changes audio/graphics without saving; try_apply_with_feedback also
publishes a visual policy. Games opt in with sync_feedback before emitting
accepted events and before sampling presentation, including while a local menu
is open. Neither operation advances or pauses gameplay, networking or replay.
Motion/flash policy is session-local: the existing preferences save format is
unchanged. Hosts own persistence and resolution of system motion vs explicit
user choices. Renderer state, audio and this policy belong to the calling thread.
Structs§
- Apply
Outcome - Result of applying a complete validated preference snapshot.
- Preferences
- Device-local presentation preferences, separate from gameplay control bindings.
- UiApply
Outcome - Result for the separate UI channel. A token change requires layout/paint/hit reconstruction, including a contrast-only change (authored styles may differ). This reports adoption by the session, not adoption by any game/renderer.
- UiPreferences
- Validated UI choices, independent of motion/flash, graphics and saved preferences.
Private fields prevent an invalid value from entering the live session.
Standard text is 1x; the player’s existing Large choice maps to 1.5x.
Explicit contrast indices are 0 (Normal) and 1 (HighContrast), never “system”.
No game is restyled until it opts into
ui_preferencesandSelf::theme.
Enums§
- UiPreference
Error - Rejected snapshots leave every live channel unchanged.
Constants§
- UI_
PREFERENCES_ VERSION - Version of the session-local UI snapshot and browser setter contract.
Functions§
- apply_
ui_ preferences - Publish a validated UI choice without persistence, renderer rebuild or gameplay
mutation. Consumers rebuild their own layout from
UiPreferences::theme. UseUiPreferences::default()for an explicit UI-only reset; see its example. - apply_
ui_ snapshot_ v1 - Validate/apply the versioned browser contract. Numeric 1 accepts (also when unchanged); 0 rejects without any side effects, including last-field failure. This deliberately excludes motion/flash: old feedback consumers stay independent.
- current
- Snapshot actual audio and underlying graphics settings, excluding temporary URL/environment look/quality overrides and queued, unapplied detail edits. This is not the saved user snapshot: direct mixer/renderer calls are visible.
- feedback_
policy - Current session-local visual policy. Hosts can inspect it to suppress their own animation/particles; already emitted external effects cannot be recalled.
- set_
feedback_ policy - Publish an already validated visual policy; returns whether it changed.
Does not write preferences, change audio/graphics, or touch a simulation clock.
Controllers receive it on their next
sync_feedbackcall. - sync_
feedback - Apply the shared visual policy to an actual feedback consumer, returning whether its policy changed. Call before accepted-event emission and frame sampling, even with no simulation tick or while local menus are open.
- try_
apply - Validate and apply a complete audio/graphics snapshot without persisting it.
Invalid fields return
StorageError::Invalidbefore any change. Unchanged settings avoid mixer setters and graphics refresh; runtime drift is repaired. Existing visual policy and explicit URL/environment overrides are preserved. - try_
apply_ with_ feedback - Apply audio, graphics and visual policy together. Invalid preferences leave
every setting, including the shared feedback policy, unchanged. Policy inputs
are validated by
FeedbackPolicy::new. No persistence or controller polling occurs; usesync_feedbackin the presentation owner. - ui_
preferences - Read the calling thread’s session-local UI choice. See
UiPreferences.