pub fn render(&self) {
        // Clear the screen.
        // -----------------
        self.renderer.clear();

        // Draw all the projectile entites, and bind the PROJECTILE_PSO before doing so.
        // -----------------------------------------------------------------------------
        entites::Projectile::pso().bind(&self.renderer);
        for p in self.projectiles.iter() {
            p.draw(&self.renderer);
        }

        // Bind enemy PSO, and then draw all enemies.
        // ------------------------------------------
        entites::Enemy::pso().bind(&self.renderer);
        for e in self.enemies.iter() {
            e.draw(&self.renderer);
        }

        // Bind the explosion PSO, and then draw all explosions.
        // ----------------------------------------------------
        self::entites::Explosion::pso().bind(&self.renderer);
        for x in self.explosions.iter() {
            x.draw(&self.renderer);
        }

        // Set up a list with various other drawables, which all take care of PSO
        // binding themselves (they are unique, so binding PSO for a batch is not
        // an improvement).
        // Then draw the list by iterating over it.
        // ----------------------------------------------------------------------
        let display_list: &[&dyn Renderable] = &[
            &self.player as &dyn Renderable,
            &self.fps_counter as &dyn Renderable,
            &self.score as &dyn Renderable,
        ];
        self.renderer.draw(&display_list);
    }
/// Render the game. This will clear the canvas, and then redraw the whole scene.
/// Does not need mutable access, because it immutably reads game date, and draws
/// to the canvas. Canvas draw operations have some kind of interior mutability,
/// which allows usage through non mutable references.
Render the game. This will clear the canvas, and then redraw the whole scene.
Does not need mutable access, because it immutably reads game date, and draws
to the canvas. Canvas draw operations have some kind of interior mutability,
which allows usage through non mutable references.
Render the game . This will clear the canvas and then redraw the whole scene . Does not need mutable access because it immutably reads game date and draws to the canvas . Canvas draw operations have some kind of interior mutability which allows usage through non mutable references .
pub fn render(&self) {
        // Clear the screen.
        // -----------------
        self.renderer.clear();
        // Draw all the projectile entites, and bind the PROJECTILE_PSO before doing so.
        // -----------------------------------------------------------------------------
        entites::Projectile::pso().bind(&self.renderer);
        for p in self.projectiles.iter() {
            p.draw(&self.renderer);
        }
        // Bind enemy PSO, and then draw all enemies.
        // ------------------------------------------
        entites::Enemy::pso().bind(&self.renderer);
        for e in self.enemies.iter() {
            e.draw(&self.renderer);
        }
        // Bind the explosion PSO, and then draw all explosions.
        // ----------------------------------------------------
        self::entites::Explosion::pso().bind(&self.renderer);
        for x in self.explosions.iter() {
            x.draw(&self.renderer);
        }
        // Set up a list with various other drawables, which all take care of PSO
        // binding themselves (they are unique, so binding PSO for a batch is not
        // an improvement).
        // Then draw the list by iterating over it.
        // ----------------------------------------------------------------------
        let display_list: &[&dyn Renderable] = &[
            &self.player as &dyn Renderable,
            &self.fps_counter as &dyn Renderable,
            &self.score as &dyn Renderable,
        ];
        self.renderer.draw(&display_list);
    }
pub fn render ( & self ) { // Clear the screen. // ----------------- self . renderer . clear ( ) ; // Draw all the projectile entites, and bind the PROJECTILE_PSO before doing so. // ----------------------------------------------------------------------------- entites :: Projectile :: pso ( ) . bind ( & self . renderer ) ; for p in self . projectiles . iter ( ) { p . draw ( & self . renderer ) ; } // Bind enemy PSO, and then draw all enemies. // ------------------------------------------ entites :: Enemy :: pso ( ) . bind ( & self . renderer ) ; for e in self . enemies . iter ( ) { e . draw ( & self . renderer ) ; } // Bind the explosion PSO, and then draw all explosions. // ---------------------------------------------------- self :: entites :: Explosion :: pso ( ) . bind ( & self . renderer ) ; for x in self . explosions . iter ( ) { x . draw ( & self . renderer ) ; } // Set up a list with various other drawables, which all take care of PSO // binding themselves (they are unique, so binding PSO for a batch is not // an improvement). // Then draw the list by iterating over it. // ---------------------------------------------------------------------- let display_list : & [ & dyn Renderable ] = & [ & self . player as & dyn Renderable , & self . fps_counter as & dyn Renderable , & self . score as & dyn Renderable , ] ; self . renderer . draw ( & display_list ) ; }
Render the game.
Render the game .
&self
&self