[−][src]Struct tetra::graphics::DrawParams
Struct representing the parameters that can be used when drawing.
You can either use this as a builder by calling DrawParams::new
and then chaining methods, or
construct it manually - whichever you find more pleasant to write.
Fields
position: Vec2
The position that the graphic should be drawn at. Defaults to [0.0, 0.0].
scale: Vec2
The scale that the graphic should be drawn at. Defaults to [1.0, 1.0].
This can be set to a negative value to flip the graphic around the origin.
origin: Vec2
The origin of the graphic. Defaults to [0.0, 0.0] (the top left).
Positioning and scaling will be calculated relative to this point.
rotation: f32
The rotation of the graphic, in radians. Defaults to 0.0.
color: Color
A color to multiply the graphic by. Defaults to white.
clip: Option<Rectangle>
A sub-region of the graphic to draw. Defaults to None
, which means the the full graphic will be drawn.
This is useful if you're using spritesheets (which you should be!).
Methods
impl DrawParams
[src]
pub fn new() -> DrawParams
[src]
Creates a new set of DrawParams
.
pub fn position(self, position: Vec2) -> DrawParams
[src]
Sets the position that the graphic should be drawn at.
pub fn scale(self, scale: Vec2) -> DrawParams
[src]
Sets the scale that the graphic should be drawn at.
pub fn origin(self, origin: Vec2) -> DrawParams
[src]
Sets the origin of the graphic.
pub fn rotation(self, rotation: f32) -> DrawParams
[src]
Sets the rotation of the graphic, in radians.
pub fn color(self, color: Color) -> DrawParams
[src]
Sets the color to multiply the graphic by.
pub fn clip(self, clip: Rectangle) -> DrawParams
[src]
Sets the region of the graphic to draw.
Trait Implementations
impl Clone for DrawParams
[src]
fn clone(&self) -> DrawParams
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq<DrawParams> for DrawParams
[src]
fn eq(&self, other: &DrawParams) -> bool
[src]
fn ne(&self, other: &DrawParams) -> bool
[src]
impl Default for DrawParams
[src]
fn default() -> DrawParams
[src]
impl From<Matrix<f32, U2, U1, <DefaultAllocator as Allocator<f32, U2, U1>>::Buffer>> for DrawParams
[src]
fn from(position: Vec2) -> DrawParams
[src]
impl Debug for DrawParams
[src]
Auto Trait Implementations
impl Send for DrawParams
impl Sync for DrawParams
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Same for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn is_in_subset(&self) -> bool
unsafe fn to_subset_unchecked(&self) -> SS
fn from_subset(element: &SS) -> SP
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
Sets value
as a parameter of self
.