[−][src]Struct block_breaker::Bar
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]
position: Position,
dimensions: Dimensions,
game_dimensions: Dimensions
) -> Bar
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]
U: From<T>,
impl<T, U> TryFrom<U> 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, U> TryInto<U> 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> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,