pub fn draw(&mut self, level: &Level) {
        self.tileset.set_extents(level.extents());

        // Draw a full-size image onto an off-screen buffer
        let fullsize = self.tileset.get_rendering_size(level.extents());
        let _ = self.renderer
                    .render_target()
                    .expect("Render targets are not supported")
                    .create_and_set(PixelFormatEnum::RGBA8888, fullsize.0, fullsize.1);

        self.draw_fullsize(level);

        // Copy onto the screen with appropriate scaling
        let final_rect = self.get_centered_image_rect(self.get_scaled_rendering_size(&level));
        let texture = self.renderer
                          .render_target()
                          .unwrap()
                          .reset()
                          .unwrap_or_else(|err| {
                              panic!("Could not reset to the default render target: {}", err)
                          })
                          .unwrap_or_else(|| panic!("Could not get the offscreen texture"));

        self.renderer.clear();
        let original_rect = Some(Rect::new(0, 0, fullsize.0, fullsize.1));
        self.renderer.copy(&texture, original_rect, final_rect);

        self.draw_status_bar(&level);

        self.renderer.present();
    }
/// Draws a level onto the screen.
Draws a level onto the screen.
Draws a level onto the screen .
pub fn draw(&mut self, level: &Level) {
        self.tileset.set_extents(level.extents());
        // Draw a full-size image onto an off-screen buffer
        let fullsize = self.tileset.get_rendering_size(level.extents());
        let _ = self.renderer
                    .render_target()
                    .expect("Render targets are not supported")
                    .create_and_set(PixelFormatEnum::RGBA8888, fullsize.0, fullsize.1);
        self.draw_fullsize(level);
        // Copy onto the screen with appropriate scaling
        let final_rect = self.get_centered_image_rect(self.get_scaled_rendering_size(&level));
        let texture = self.renderer
                          .render_target()
                          .unwrap()
                          .reset()
                          .unwrap_or_else(|err| {
                              panic!("Could not reset to the default render target: {}", err)
                          })
                          .unwrap_or_else(|| panic!("Could not get the offscreen texture"));
        self.renderer.clear();
        let original_rect = Some(Rect::new(0, 0, fullsize.0, fullsize.1));
        self.renderer.copy(&texture, original_rect, final_rect);
        self.draw_status_bar(&level);
        self.renderer.present();
    }
pub fn draw ( & mut self , level : & Level ) { self . tileset . set_extents ( level . extents ( ) ) ; // Draw a full-size image onto an off-screen buffer let fullsize = self . tileset . get_rendering_size ( level . extents ( ) ) ; let _ = self . renderer . render_target ( ) . expect ( " " ) . create_and_set ( PixelFormatEnum :: RGBA8888 , fullsize . 0 , fullsize . 1 ) ; self . draw_fullsize ( level ) ; // Copy onto the screen with appropriate scaling let final_rect = self . get_centered_image_rect ( self . get_scaled_rendering_size ( & level ) ) ; let texture = self . renderer . render_target ( ) . unwrap ( ) . reset ( ) . unwrap_or_else ( | err | { panic ! ( " " err ) } ) . unwrap_or_else ( | | panic ! ( " " ) ) ; self . renderer . clear ( ) ; let original_rect = Some ( Rect :: new ( 0 , 0 , fullsize . 0 , fullsize . 1 ) ) ; self . renderer . copy ( & texture , original_rect , final_rect ) ; self . draw_status_bar ( & level ) ; self . renderer . present ( ) ; }
Draws a level onto the screen.
Draws a level onto the screen .
&mut self
level
&Level