#[repr(C)]pub struct Camera2D {
pub offset: Vector2,
pub target: Vector2,
pub rotation: f32,
pub zoom: f32,
}
Expand description
Camera2D, defines position/orientation in 2d space
Fields§
§offset: Vector2
Camera offset (displacement from target)
target: Vector2
Camera target (rotation and zoom origin)
rotation: f32
Camera rotation in degrees
zoom: f32
Camera zoom (scaling), should be 1.0f by default
Implementations§
Source§impl Camera2D
impl Camera2D
Sourcepub fn get_matrix(&self) -> Matrix
pub fn get_matrix(&self) -> Matrix
Get camera 2d transform matrix
Sourcepub fn screen_to_world(&self, position: Vector2) -> Vector2
pub fn screen_to_world(&self, position: Vector2) -> Vector2
Get the world space position for a 2d camera screen space position
Sourcepub fn world_to_screen(&self, position: Vector2) -> Vector2
pub fn world_to_screen(&self, position: Vector2) -> Vector2
Get the screen space position for a 2d camera world space position
Trait Implementations§
impl Copy for Camera2D
impl StructuralPartialEq for Camera2D
Auto Trait Implementations§
impl Freeze for Camera2D
impl RefUnwindSafe for Camera2D
impl Send for Camera2D
impl Sync for Camera2D
impl Unpin for Camera2D
impl UnwindSafe for Camera2D
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