fn draw(&mut self, ctx: &mut ggez::Context) -> GameResult {
        // Clear the graphics window
        graphics::clear(ctx, [0.0, 0.0, 0.0, 1.0].into());

        // Check if the simulation has been initialized
        if !self.initialized {
            // Retrieve the size of the graphics window
            let width = graphics::screen_coordinates(ctx).w;
            let height = graphics::screen_coordinates(ctx).h;
            // Create rectangle dimensions
            let dimensions = graphics::Rect::new(0.0, 0.0, width, height);

            // Initialize the automaton with the screen dimensions
            self.automaton.initialize(dimensions);
            // Set the initialized flag to true
            self.initialized = true;
        }

        // Render the automaton state
        self.automaton.draw(ctx, (na::Point2::new(0.0, 0.0),).into())?;
        // Present the graphics on the window
        graphics::present(ctx)?;
        
        // Return an GameResult::Ok
        Ok(())
    }
/// A method that is called when a render event is to be triggered by the event loop
A method that is called when a render event is to be triggered by the event loop
A method that is called when a render event is to be triggered by the event loop
fn draw(&mut self, ctx: &mut ggez::Context) -> GameResult {
        // Clear the graphics window
        graphics::clear(ctx, [0.0, 0.0, 0.0, 1.0].into());
        // Check if the simulation has been initialized
        if !self.initialized {
            // Retrieve the size of the graphics window
            let width = graphics::screen_coordinates(ctx).w;
            let height = graphics::screen_coordinates(ctx).h;
            // Create rectangle dimensions
            let dimensions = graphics::Rect::new(0.0, 0.0, width, height);
            // Initialize the automaton with the screen dimensions
            self.automaton.initialize(dimensions);
            // Set the initialized flag to true
            self.initialized = true;
        }
        // Render the automaton state
        self.automaton.draw(ctx, (na::Point2::new(0.0, 0.0),).into())?;
        // Present the graphics on the window
        graphics::present(ctx)?;
        // Return an GameResult::Ok
        Ok(())
    }
fn draw ( & mut self , ctx : & mut ggez :: Context ) -> GameResult { // Clear the graphics window graphics :: clear ( ctx , [ 0.0 , 0.0 , 0.0 , 1.0 ] . into ( ) ) ; // Check if the simulation has been initialized if ! self . initialized { // Retrieve the size of the graphics window let width = graphics :: screen_coordinates ( ctx ) . w ; let height = graphics :: screen_coordinates ( ctx ) . h ; // Create rectangle dimensions let dimensions = graphics :: Rect :: new ( 0.0 , 0.0 , width , height ) ; // Initialize the automaton with the screen dimensions self . automaton . initialize ( dimensions ) ; // Set the initialized flag to true self . initialized = true ; } // Render the automaton state self . automaton . draw ( ctx , ( na :: Point2 :: new ( 0.0 , 0.0 ) , ) . into ( ) ) ? ; // Present the graphics on the window graphics :: present ( ctx ) ? ; // Return an GameResult::Ok Ok ( ( ) ) }
A method that is called when a render event is to be triggered by the event loop
A method that is called when a render event is to be triggered by the event loop
&mut self
ctx
&mut ggez::Context
&mut self
ctx
&mut ggez::Context