[−][src]Struct tetra::graphics::DrawParams
Parameters that can be manipulated when drawing an object.
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<f32>
The position that the graphic should be drawn at. Defaults to (0.0, 0.0)
.
scale: Vec2<f32>
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<f32>
The origin of the graphic. Defaults to (0.0, 0.0)
(the top left).
This offset is applied before scaling, rotation and positioning. For example, if you have a 16x16 image and set the origin to [8.0, 8.0], subsequent transformations will be performed relative to the center of the image.
rotation: f32
The rotation of the graphic, in radians. Defaults to 0.0
.
color: Color
A color to multiply the graphic by. Defaults to Color::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, if you want good performance!).
Implementations
impl DrawParams
[src]
pub fn new() -> DrawParams
[src]
Creates a new set of DrawParams
.
pub fn position(self, position: Vec2<f32>) -> DrawParams
[src]
Sets the position that the graphic should be drawn at.
pub fn scale(self, scale: Vec2<f32>) -> DrawParams
[src]
Sets the scale that the graphic should be drawn at.
pub fn origin(self, origin: Vec2<f32>) -> 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]
impl Debug for DrawParams
[src]
impl Default for DrawParams
[src]
fn default() -> DrawParams
[src]
impl From<Vec2<f32>> for DrawParams
[src]
fn from(position: Vec2<f32>) -> DrawParams
[src]
impl PartialEq<DrawParams> for DrawParams
[src]
fn eq(&self, other: &DrawParams) -> bool
[src]
fn ne(&self, other: &DrawParams) -> bool
[src]
impl StructuralPartialEq for DrawParams
[src]
Auto Trait Implementations
impl RefUnwindSafe for DrawParams
impl Send for DrawParams
impl Sync for DrawParams
impl Unpin for DrawParams
impl UnwindSafe for DrawParams
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,