pub struct Camera2D {
pub rotation: f32,
pub zoom: Vec2,
pub target: Vec2,
pub offset: Vec2,
pub render_target: Option<RenderTarget>,
}
Fields
rotation: f32
Rotation in degrees
zoom: Vec2
Scaling, should be (1.0, 1.0) by default
target: Vec2
Rotation and zoom origin
offset: Vec2
Displacement from target
render_target: Option<RenderTarget>
If “render_target” is set - camera will render to texture otherwise to the screen
Implementations
sourceimpl Camera2D
impl Camera2D
sourcepub fn from_display_rect(rect: Rect) -> Camera2D
pub fn from_display_rect(rect: Rect) -> Camera2D
Will make camera space equals given rect
sourceimpl Camera2D
impl Camera2D
sourcepub fn world_to_screen(&self, point: Vec2) -> Vec2
pub fn world_to_screen(&self, point: Vec2) -> Vec2
Returns the screen space position for a 2d camera world space position Screen position in window space - from (0, 0) to (screen_width, screen_height())
pub fn screen_to_world(&self, point: Vec2) -> Vec2
Trait Implementations
sourceimpl Camera for Camera2D
impl Camera for Camera2D
fn matrix(&self) -> Mat4
fn depth_enabled(&self) -> bool
fn render_pass(&self) -> Option<RenderPass>
impl Copy for Camera2D
Auto Trait Implementations
impl RefUnwindSafe for Camera2D
impl Send for Camera2D
impl Sync for Camera2D
impl Unpin for Camera2D
impl UnwindSafe for Camera2D
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more