Struct riddle_renderer_wgpu::SpriteRenderCommand[][src]

pub struct SpriteRenderCommand { /* fields omitted */ }

Builder for a Sprite render call

Defaults:

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]

Invoke the render command, for the given sprite, in the specified context

Trait Implementations

impl Clone for SpriteRenderCommand[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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.