Struct gust_render::view::View
source · pub struct View { /* private fields */ }
Expand description
A View is a 2D camera. It’s the screen viewport. You can make multiple views and use them as Minimap, 2nd player screen etc… The view is attached to a gust::Window.
Implementations
sourceimpl View
impl View
sourcepub fn new(pos: Point<f32>, rect: Rect<f32>) -> View
pub fn new(pos: Point<f32>, rect: Rect<f32>) -> View
Create a new View from a pos point and a Rect
sourcepub fn reset(&mut self, rect: Rect<f32>)
pub fn reset(&mut self, rect: Rect<f32>)
Reset the rect if you don’t want to you can use (set_sizes)[]
sourcepub fn set_center(&mut self, pos: Point<f32>)
pub fn set_center(&mut self, pos: Point<f32>)
Set pos of the view (usefull for game like 2D Zelda-Like)
sourcepub fn set_viewport(&mut self, viewport: Rect<f32>)
pub fn set_viewport(&mut self, viewport: Rect<f32>)
Set the viewport of the view (the viewport is given as a float factor 0.5 / 1.0 / 0.2 etc) That way people can simply handle screen part.
sourcepub fn translate<T: Scalar + Into<f32>>(&mut self, offset: Vector<T>)
pub fn translate<T: Scalar + Into<f32>>(&mut self, offset: Vector<T>)
Move the view from actual position with the offset offset
.
sourcepub fn projection(&self) -> &Matrix4<f32>
pub fn projection(&self) -> &Matrix4<f32>
Return projection Matrix4.
Trait Implementations
impl StructuralPartialEq for View
Auto Trait Implementations
impl RefUnwindSafe for View
impl Send for View
impl Sync for View
impl Unpin for View
impl UnwindSafe for View
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
impl<T> Pointable for T
impl<T> Pointable for T
impl<T> SetParameter for T
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Resultwhere
T: Parameter<Self>,
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Resultwhere
T: Parameter<Self>,
Sets
value
as a parameter of self
.sourceimpl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
sourcefn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moresourcefn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).sourceunsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.sourcefn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.