[−][src]Struct elma::state::State
State.dat struct
Fields
path: Option<PathBuf>
Path to State file.
version: u32
State file version; the only supported value is 200.
times: Vec<BestTimes>
Best times lists. state.dat has a fixed-size array of 90 of these.
players: Vec<PlayerEntry>
List of players. state.dat has a fixed-size array of 50 of these.
player_a_name: String
Name of player A, maximum 14 characters.
player_b_name: String
Name of player B, maximum 14 characters.
player_a_keys: PlayerKeys
Keys for player A.
player_b_keys: PlayerKeys
Keys for player B.
sound_enabled: bool
Whether sound is enabled.
sound_optimization: SoundOptimization
Sound optimization.
play_mode: PlayMode
Play mode.
flagtag: bool
Whether flag tag mode is enabled.
swap_bikes: bool
Whether bikes are swapped.
video_detail: VideoDetail
Video detail.
animated_objects: bool
Whether objects are animated.
Whether menus are animated.
inc_screen_size_key: u32
Key for increasing screen size.
dec_screen_size_key: u32
Key for decreasing screen size.
screenshot_key: u32
Key for taking a screenshot.
last_edited_lev_name: String
Name of last edited level.
last_played_external: String
Name of last played external level.
Methods
impl State
[src]
pub fn new() -> Self
[src]
Create a new state.dat.
pub fn load<P: Into<PathBuf>>(path: P) -> Result<Self, ElmaError>
[src]
pub fn from_bytes<B: AsRef<[u8]>>(buffer: B) -> Result<Self, ElmaError>
[src]
pub fn to_bytes(&self) -> Result<Vec<u8>, ElmaError>
[src]
Returns state.dat as a stream of bytes.
Examples
let mut state = State::load("state.dat").unwrap(); let buffer = state.to_bytes().unwrap();
pub fn save<P: Into<PathBuf>>(&mut self, path: P) -> Result<(), ElmaError>
[src]
Save state.dat
Examples
let mut state = State::load("state.dat").unwrap(); state.save("newstate.dat").unwrap();
Trait Implementations
impl Default for State
[src]
impl PartialEq<State> for State
[src]
impl Clone for State
[src]
fn clone(&self) -> State
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for State
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,