Struct elma::state::State [−][src]
pub struct State { pub version: u32, pub times: Vec<BestTimes>, pub players: Vec<PlayerEntry>, pub player_a_name: String, pub player_b_name: String, pub player_a_keys: PlayerKeys, pub player_b_keys: PlayerKeys, pub sound_enabled: bool, pub sound_optimization: SoundOptimization, pub play_mode: PlayMode, pub flagtag: bool, pub swap_bikes: bool, pub video_detail: VideoDetail, pub animated_objects: bool, pub animated_menus: bool, pub inc_screen_size_key: u32, pub dec_screen_size_key: u32, pub screenshot_key: u32, pub last_edited_lev_name: String, pub last_played_external: String, }
State.dat struct
Fields
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]
impl State
pub fn new() -> Self
[src]
pub fn new() -> Self
Create a new state.dat.
pub fn load<P: AsRef<Path>>(filename: P) -> Result<Self, ElmaError>
[src]
pub fn load<P: AsRef<Path>>(filename: P) -> Result<Self, ElmaError>
pub fn from_bytes<B: AsRef<[u8]>>(buffer: B) -> Result<Self, ElmaError>
[src]
pub fn from_bytes<B: AsRef<[u8]>>(buffer: B) -> Result<Self, ElmaError>
pub fn to_bytes(&self) -> Result<Vec<u8>, ElmaError>
[src]
pub fn to_bytes(&self) -> Result<Vec<u8>, ElmaError>
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: AsRef<Path>>(&mut self, filename: P) -> Result<(), ElmaError>
[src]
pub fn save<P: AsRef<Path>>(&mut self, filename: P) -> Result<(), ElmaError>
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 Default for State
impl Debug for State
[src]
impl Debug for State
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for State
[src]
impl Clone for State
fn clone(&self) -> State
[src]
fn clone(&self) -> State
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl PartialEq for State
[src]
impl PartialEq for State