Skip to main content

OptionRow

Struct OptionRow 

Source
pub struct OptionRow<G: GameData> {
    pub key: &'static str,
    pub value: RowValue<G>,
    pub starts_group: bool,
    pub unsaved: bool,
}
Expand description

One row of an options screen, as the game gives it.

Fields§

§key: &'static str

The text key of its label; also what names the row (the focus).

§value: RowValue<G>

What it shows beside its label, and what changes it.

§starts_group: bool

Whether a blank row comes before it (the first row of a group).

§unsaved: bool

Whether its value isn’t one of the settings, so the screen keeps or puts it back itself on leaving (a campaign’s own level, say).

Implementations§

Source§

impl<G: GameData> OptionRow<G>

Source

pub fn new(key: &'static str, value: RowValue<G>) -> Self

A row labelled by the text key key, showing value.

Source

pub fn starting_group(self) -> Self

The same row, first of a group: a blank row comes before it.

Source

pub fn unsaved(self) -> Self

The same row, whose value isn’t one of the settings: the screen keeps it or puts it back itself on leaving.

Source

pub fn text_speed() -> Self

The speed text is revealed at (TextSpeed, in the settings).

Source

pub fn frame_cap() -> Self

The most frames a second the platform shows (the frame cap, in the settings), labelled Frame rate (FRAME_CAP_ROW): it steps through the game’s choices (GameSettings::FRAME_CAP_CHOICES), each shown as “60 FPS” (FPS_KEY) or “Unlimited” (UNLIMITED_KEY). A cap that isn’t among them (set in code) shows as it is, and steps from the first. The platform applies a change from the next frame, before the player keeps it.

Source

pub fn fullscreen() -> Self

Whether the game fills the screen (in the settings). The options screen leaves it out where the game isn’t in a window (OptionsScreen::rows).

Source

pub fn music_volume() -> Self

How loud the music plays (in the settings).

Source

pub fn sound_volume() -> Self

How loud the sounds play (in the settings).

Source

pub fn voices() -> Self

Whether voice clips play (in the settings). Turning it off stops the voice that is playing.

Source

pub fn voice_volume() -> Self

How loud voice clips play (in the settings).

Source

pub fn restore_defaults() -> Self

Puts every setting back to its default but the layout, asking first; kept or thrown away on leaving, like any change.

Source

pub fn is_setting(&self) -> bool

Whether the cursor’s left and right keys change its value.

Auto Trait Implementations§

§

impl<G> Freeze for OptionRow<G>

§

impl<G> RefUnwindSafe for OptionRow<G>

§

impl<G> Send for OptionRow<G>

§

impl<G> Sync for OptionRow<G>

§

impl<G> Unpin for OptionRow<G>

§

impl<G> UnsafeUnpin for OptionRow<G>

§

impl<G> UnwindSafe for OptionRow<G>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.