pub struct Game { /* private fields */ }
Expand description
A type representing a game of Tetris.
Implementations§
Source§impl Game
impl Game
Sourcepub fn with_config(config: &Config) -> Result<Self>
pub fn with_config(config: &Config) -> Result<Self>
Instantiate a new game of Tetris with the given configuration.
Sourcepub fn tick(&mut self, now: Instant) -> (Change, Tick)
pub fn tick(&mut self, now: Instant) -> (Change, Tick)
Fast-forward the game to the current time.
This includes moving the currently active stone according to the elapsed time since the last update.
Sourcepub fn width(&self) -> NonZeroU16
pub fn width(&self) -> NonZeroU16
Retrieve the game surface’s width.
Sourcepub fn height(&self) -> NonZeroU16
pub fn height(&self) -> NonZeroU16
Retrieve the game surface’s height.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Game
impl !RefUnwindSafe for Game
impl !Send for Game
impl !Sync for Game
impl Unpin for Game
impl !UnwindSafe for Game
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more