fn initialise_paddles(&self, world: &mut World, sprite_sheet_handle: Handle<SpriteSheet>) -> (Entity, Entity) {
        let mut left_transform = Transform::default();
        let mut right_transform = Transform::default();
        let sprite_render = SpriteRender::new(sprite_sheet_handle, 0);

        // Correctly position the paddles.
        let y = self.window_settings.arena_height() / 2.0;
        left_transform.set_translation_xyz(self.window_settings.paddle_width() * 0.5, y, 0.0);
        left_transform.set_scale(Vector3::new(self.window_settings.paddle_width_scale(), self.window_settings.paddle_height_scale(), 1.0));
        right_transform.set_translation_xyz(self.window_settings.arena_width() - self.window_settings.paddle_width() * 0.5, y, 0.0);
        right_transform.set_scale(Vector3::new(self.window_settings.paddle_width_scale(), self.window_settings.paddle_height_scale(), 1.0));

        // Create a left plank entity.
        (world
             .create_entity()
             .with(sprite_render.clone())
             .with(Paddle::new(Side::Left, self.window_settings.paddle_height(), self.window_settings.paddle_width()))
             .with(left_transform)
             .build(),
         world
             .create_entity()
             .with(sprite_render)
             .with(Paddle::new(Side::Right, self.window_settings.paddle_height(), self.window_settings.paddle_width()))
             .with(right_transform)
             .build())
    }
/// Initialises one paddle on the left, and one paddle on the right.
Initialises one paddle on the left, and one paddle on the right.
Initialises one paddle on the left and one paddle on the right .
fn initialise_paddles(&self, world: &mut World, sprite_sheet_handle: Handle<SpriteSheet>) -> (Entity, Entity) {
        let mut left_transform = Transform::default();
        let mut right_transform = Transform::default();
        let sprite_render = SpriteRender::new(sprite_sheet_handle, 0);
        // Correctly position the paddles.
        let y = self.window_settings.arena_height() / 2.0;
        left_transform.set_translation_xyz(self.window_settings.paddle_width() * 0.5, y, 0.0);
        left_transform.set_scale(Vector3::new(self.window_settings.paddle_width_scale(), self.window_settings.paddle_height_scale(), 1.0));
        right_transform.set_translation_xyz(self.window_settings.arena_width() - self.window_settings.paddle_width() * 0.5, y, 0.0);
        right_transform.set_scale(Vector3::new(self.window_settings.paddle_width_scale(), self.window_settings.paddle_height_scale(), 1.0));
        // Create a left plank entity.
        (world
             .create_entity()
             .with(sprite_render.clone())
             .with(Paddle::new(Side::Left, self.window_settings.paddle_height(), self.window_settings.paddle_width()))
             .with(left_transform)
             .build(),
         world
             .create_entity()
             .with(sprite_render)
             .with(Paddle::new(Side::Right, self.window_settings.paddle_height(), self.window_settings.paddle_width()))
             .with(right_transform)
             .build())
    }
fn initialise_paddles ( & self , world : & mut World , sprite_sheet_handle : Handle < SpriteSheet > ) -> ( Entity , Entity ) { let mut left_transform = Transform :: default ( ) ; let mut right_transform = Transform :: default ( ) ; let sprite_render = SpriteRender :: new ( sprite_sheet_handle , 0 ) ; // Correctly position the paddles. let y = self . window_settings . arena_height ( ) / 2.0 ; left_transform . set_translation_xyz ( self . window_settings . paddle_width ( ) * 0.5 , y , 0.0 ) ; left_transform . set_scale ( Vector3 :: new ( self . window_settings . paddle_width_scale ( ) , self . window_settings . paddle_height_scale ( ) , 1.0 ) ) ; right_transform . set_translation_xyz ( self . window_settings . arena_width ( ) - self . window_settings . paddle_width ( ) * 0.5 , y , 0.0 ) ; right_transform . set_scale ( Vector3 :: new ( self . window_settings . paddle_width_scale ( ) , self . window_settings . paddle_height_scale ( ) , 1.0 ) ) ; // Create a left plank entity. ( world . create_entity ( ) . with ( sprite_render . clone ( ) ) . with ( Paddle :: new ( Side :: Left , self . window_settings . paddle_height ( ) , self . window_settings . paddle_width ( ) ) ) . with ( left_transform ) . build ( ) , world . create_entity ( ) . with ( sprite_render ) . with ( Paddle :: new ( Side :: Right , self . window_settings . paddle_height ( ) , self . window_settings . paddle_width ( ) ) ) . with ( right_transform ) . build ( ) ) }
Initialises one paddle on the left, and one paddle on the right.
Initialises one paddle on the left and one paddle on the right .
&self
world
&mut World
sprite_sheet_handle
Handle<SpriteSheet>
&self
world
&mut World
sprite_sheet_handle
Handle<SpriteSheet>