[][src]Trait babalcore::LevelQuery

pub trait LevelQuery {
    pub fn width(&self) -> usize;
pub fn len(&self) -> usize;
pub fn first(&self) -> isize;
pub fn last(&self) -> isize;
pub fn item(&self, col: isize, row: isize, now_msec: i64) -> i64; }

Required methods

pub fn width(&self) -> usize[src]

pub fn len(&self) -> usize[src]

pub fn first(&self) -> isize[src]

pub fn last(&self) -> isize[src]

pub fn item(&self, col: isize, row: isize, now_msec: i64) -> i64[src]

Loading content...

Implementors

impl LevelQuery for Level[src]

pub fn width(&self) -> usize[src]

Get the level width. It is fixed for a given game session.

Examples

use babalcore::*;

let level = Level::new(0, 10, Skill::Easy);
assert_eq!(10, level.width());

pub fn len(&self) -> usize[src]

Get the level length. Length typically increases as the ball rolls on. However it is capped at some point and history at the beginning of the level is removed. View this as a sliding window.

Examples

use babalcore::*;

let level = Level::new(0, 10, Skill::Easy);
assert_eq!(0, level.len());

pub fn first(&self) -> isize[src]

Get the level first row, the row with the lowest index.

Examples

use babalcore::*;

let level = Level::new(0, 10, Skill::Easy);
assert_eq!(0, level.len());

pub fn last(&self) -> isize[src]

Get the level last row, more precisely its index plus one. So if last is equal to first, then len is 0 an there are no rows at all.

Examples

use babalcore::*;

let level = Level::new(0, 10, Skill::Easy);
assert_eq!(0, level.len());

pub fn item(&self, col: isize, row: isize, now_msec: i64) -> i64[src]

Get a level content, returns a plain integer.

Examples

use babalcore::*;

let mut level = Level::new(0, 10, Skill::Easy);
level.generate(2);
assert_eq!(0, level.item(5, 1, 3000));
Loading content...