[−][src]Struct elma::lev::Level
Level struct that contains all level information.
Fields
version: Version
Elma or Across level.
link: u32
Random number that links level file to replay files.
integrity: [f64; 4]
Contains four integrity checks.
title: String
Level title.
lgr: String
LGR file name.
ground: String
Ground texture name.
sky: String
Sky texture name.
polygons: Vec<Polygon>
Vector with all polygons (See Polygon
).
objects: Vec<Object>
Vector with all objects (See Object
).
pictures: Vec<Picture>
Vector with all pictures (See Picture
).
best_times: BestTimes
Best times lists.
path: Option<PathBuf>
Level path, if loaded/saved.
Methods
impl Level
[src]
pub fn new() -> Self
[src]
pub fn load<P: Into<PathBuf>>(path: P) -> Result<Self, ElmaError>
[src]
Loads a level file and returns a Level
struct.
Examples
let level = Level::load("tests/assets/levels/test_1.lev").unwrap();
pub fn from_bytes<B: AsRef<[u8]>>(buffer: B) -> Result<Self, ElmaError>
[src]
pub fn to_bytes(&self, top_10: Top10Save) -> Result<Vec<u8>, ElmaError>
[src]
Converts all struct fields into raw binary form and returns the raw data.
Arguments
top10
- Specifies whether to keep the top10 list (true), or write an empty list (false).
Examples
let mut level = Level::new(); let raw_bytes = level.to_bytes(Top10Save::No).unwrap();
pub fn width(&self) -> f64
[src]
Width of level based on left- and right-most vertices.
pub fn height(&self) -> f64
[src]
Height of level based on top and bottom-most vertices.
pub fn check_topology(&self) -> Result<(), TopologyError>
[src]
Check topology of level.
pub fn generate_link(&mut self)
[src]
Generate a random link number. When you save a level, it will keep the original link number unless explicitly changed manually or by running this function before saving.
Examples
let mut level = Level::new(); level.generate_link(); level.save("newlink.lev", Top10Save::No).unwrap();
pub fn save<P: Into<PathBuf>>(
&mut self,
path: P,
top10: Top10Save
) -> Result<(), ElmaError>
[src]
&mut self,
path: P,
top10: Top10Save
) -> Result<(), ElmaError>
Trait Implementations
impl BoundingBox for Level
[src]
impl PartialEq<Level> for Level
[src]
impl Default for Level
[src]
impl Debug for Level
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
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> 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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,