Struct tinybit::camera::Camera[][src]

pub struct Camera<T> {
    pub position: WorldPos,
    // some fields omitted
}

Camera

Fields

position: WorldPos

Global position

Implementations

impl<T> Camera<T>[src]

pub fn resize(&mut self, width: u16, height: u16)[src]

Resize the camera

pub fn to_screen(&self, pos: WorldPos) -> ScreenPos[src]

Convert a point to local space.

pub fn move_to(&mut self, new_pos: WorldPos)[src]

Move the camera to a new position in global space

impl Camera<NoLimit>[src]

pub fn from_viewport(position: WorldPos, viewport: &Viewport) -> Camera<NoLimit>[src]

Create a new camera at a specific world position, with a fixed size.

pub fn new(position: WorldPos, size: WorldSize) -> Camera<NoLimit>[src]

Create a new camera

pub fn with_limit(
    self,
    top: u16,
    right: u16,
    bottom: u16,
    left: u16
) -> Camera<Limit>
[src]

The limit is used for tracking. For more information see tracking. given a limit of 1, 1, 1, 1, c represents the centre:

[ ] [ ] [ ] [ ] [ ]
[ ] [x] [x] [x] [ ]
[ ] [x] [c] [x] [ ]
[ ] [x] [x] [x] [ ]
[ ] [ ] [ ] [ ] [ ]

impl Camera<Limit>[src]

pub fn track(&mut self, pos: WorldPos)[src]

Move the camera if the target is outside of the camera’s limit box

Auto Trait Implementations

impl<T> RefUnwindSafe for Camera<T> where
    T: RefUnwindSafe

impl<T> Send for Camera<T> where
    T: Send

impl<T> Sync for Camera<T> where
    T: Sync

impl<T> Unpin for Camera<T> where
    T: Unpin

impl<T> UnwindSafe for Camera<T> where
    T: UnwindSafe

Blanket Implementations

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

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

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

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.