Struct riddle_renderer_wgpu::SpriteRenderCommand [−][src]
Builder for a Sprite
render call
Defaults:
- Pivot:
(0,0)
- Scale:
(1,1)
- Angle:
0
- Diffuse Color:
Color::WHITE
The location refers to the location of the pivot of the sprite. The pivot of the sprite is relative to the top left of the sprite.
Example
let sprite = SpriteBuilder::new(img).build(&renderer)?; let mut render_ctx = renderer.begin_render()?; render_ctx.clear(Color::WHITE)?; // Render the sprite SpriteRenderCommand::new(vec2(0.0, 0.0)) .with_scale(vec2(1.0, 2.0)) .with_color(Color::RED) .render(&mut render_ctx, &sprite)?; render_ctx.present()?;
Implementations
impl SpriteRenderCommand
[src]
pub fn new<T: Into<Vector2<f32>>>(location: T) -> Self
[src]
New render command with default args, at the specified location
pub fn at<T: Into<Vector2<f32>>>(&mut self, location: T) -> &mut Self
[src]
Set the location of the sprite, specifying where the pivot should be placed.
pub fn with_pivot<T: Into<Vector2<f32>>>(&mut self, pivot: T) -> &mut Self
[src]
Set the pivot of the sprite, relative to the top left of the sprite
pub fn with_scale<T: Into<Vector2<f32>>>(&mut self, scale: T) -> &mut Self
[src]
Set the scale at which the sprite will be rendered
pub fn with_angle(&mut self, angle: f32) -> &mut Self
[src]
Set the angle at which the sprite will be rendered, in radians.
pub fn with_color(&mut self, color: Color<f32>) -> &mut Self
[src]
Set the diffuse color of the sprite, which will be multiplied by the sprite colors.
pub fn render<Device>(
&self,
render_ctx: &mut impl RenderContext,
sprite: &WGPUSprite<Device>
) -> Result<(), RendererError> where
Device: WGPUDevice,
[src]
&self,
render_ctx: &mut impl RenderContext,
sprite: &WGPUSprite<Device>
) -> Result<(), RendererError> where
Device: WGPUDevice,
Invoke the render command, for the given sprite, in the specified context
Trait Implementations
impl Clone for SpriteRenderCommand
[src]
fn clone(&self) -> SpriteRenderCommand
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for SpriteRenderCommand
[src]
impl Default for SpriteRenderCommand
[src]
Auto Trait Implementations
impl RefUnwindSafe for SpriteRenderCommand
impl Send for SpriteRenderCommand
impl Sync for SpriteRenderCommand
impl Unpin for SpriteRenderCommand
impl UnwindSafe for SpriteRenderCommand
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,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,