/// Draws a batch of sprites, either textured or colored.
///
/// See [BatchRenderer::draw].
Draws a batch of sprites, either textured or colored.
Draws a batch of sprites either textured or colored .
pub fn draw<'a>(
        &mut self,
        cx: &Context,
        pass: &mut ArenaRenderPass,
        batch: impl Into<SpriteBatch<'a>>,
    ) {
        let (texture, draws) = match batch.into() {
            SpriteBatch::Textured { texture, draws } => (
                texture,
                draws
                    .iter()
                    .map(|draw| BatchDraw {
                        color: draw.color,
                        src_rect: draw.src_rect,
                        transform: self.matrix * rect_matrix(draw.rect, draw.rotation),
                    })
                    .collect::<Vec<_>>(),
            ),
            SpriteBatch::Color { draws } => (
                &self.white,
                draws
                    .iter()
                    .map(|draw| BatchDraw {
                        color: draw.color,
                        src_rect: Rect::ONE,
                        transform: self.matrix * rect_matrix(draw.rect, draw.rotation),
                    })
                    .collect(),
            ),
        };
        self.renderer.draw(cx, pass, &self.rect, texture, &draws);
    }
pub fn draw < ' a > ( & mut self , cx : & Context , pass : & mut ArenaRenderPass , batch : impl Into < SpriteBatch < ' a > > , ) { let ( texture , draws ) = match batch . into ( ) { SpriteBatch :: Textured { texture , draws } => ( texture , draws . iter ( ) . map ( | draw | BatchDraw { color : draw . color , src_rect : draw . src_rect , transform : self . matrix * rect_matrix ( draw . rect , draw . rotation ) , } ) . collect :: < Vec < _ > > ( ) , ) , SpriteBatch :: Color { draws } => ( & self . white , draws . iter ( ) . map ( | draw | BatchDraw { color : draw . color , src_rect : Rect :: ONE , transform : self . matrix * rect_matrix ( draw . rect , draw . rotation ) , } ) . collect ( ) , ) , } ; self . renderer . draw ( cx , pass , & self . rect , texture , & draws ) ; }
Draws a batch of sprites, either textured or colored.
Draws a batch of sprites either textured or colored .
&mut self
cx
&Context
pass
&mut ArenaRenderPass
batch
impl Into<SpriteBatch<'a>>