[][src]Struct block_breaker::Bar

pub struct Bar { /* fields omitted */ }

The user controlled bar

Restricted to moving left and right. The ball bounces off this at varying angles depending on the position.

Methods

impl Bar[src]

pub fn new(
    position: Position,
    dimensions: Dimensions,
    game_dimensions: Dimensions
) -> Bar
[src]

Create a new bar

pub fn move_left(&mut self)[src]

Move the bar one unit left

pub fn move_right(&mut self)[src]

Move the bar one unit right

pub fn update_dimensions(&mut self, dimensions: Dimensions)[src]

Update the game dimensions stored in the bar This clamps the bar's position if it would be outside the game on resize

pub fn x(&self) -> u16[src]

Get the x coordinate of the bar

pub fn y(&self) -> u16[src]

Get the y coordinate of the bar

pub fn height(&self) -> u16[src]

Get the height of the bar

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

Get the width of the bar

Auto Trait Implementations

impl Send for Bar

impl Unpin for Bar

impl Sync for Bar

impl UnwindSafe for Bar

impl RefUnwindSafe for Bar

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]