fn rendersim<T: Automaton>(automaton: &mut Result<Simulation<T>, ggez::GameError>, grid_w: f32, grid_h: f32, cell_size: f32, fps: u32, author: &str) -> ggez::GameResult {
    use ggez::{conf, event};

    // Check if the automaton has any errors
    match automaton {
        // Render the automaton
        Ok(simulation) => {
            // Get the name of the automaton
            let simname = simulation.automaton.name();
            // Create ggez WindowMode.
            let w_mode: conf::WindowMode = conf::WindowMode::default().dimensions(grid_w, grid_h + 60.0);
            // Create ggez Window with the automaton name
            let w_setup = conf::WindowSetup::default().title(simname.as_str());
            // Create a ggez context with the window mode and window setup
            let cb = ggez::ContextBuilder::new(simname.as_str(), author)
                .window_mode(w_mode)
                .window_setup(w_setup);

            // Print the simulation config
            println!("Running {} | {}x{} | {}px @ {} FPS", simname, grid_w, grid_h, cell_size, fps);
            // Build the context and event loop
            let (ctx, event_loop) = &mut cb.build()?;
            // Start the simulation event loop
            event::run(ctx, event_loop, simulation)
        },

        // Print an error and exit
        Err(err) => {
            eprintln!("[error] could not render simulation. {}", err);
            std::process::exit(0);
        }
    }        
}
// A function that renders the simulation in a window
A function that renders the simulation in a window
A function that renders the simulation in a window
fn rendersim<T: Automaton>(automaton: &mut Result<Simulation<T>, ggez::GameError>, grid_w: f32, grid_h: f32, cell_size: f32, fps: u32, author: &str) -> ggez::GameResult {
    use ggez::{conf, event};
    // Check if the automaton has any errors
    match automaton {
        // Render the automaton
        Ok(simulation) => {
            // Get the name of the automaton
            let simname = simulation.automaton.name();
            // Create ggez WindowMode.
            let w_mode: conf::WindowMode = conf::WindowMode::default().dimensions(grid_w, grid_h + 60.0);
            // Create ggez Window with the automaton name
            let w_setup = conf::WindowSetup::default().title(simname.as_str());
            // Create a ggez context with the window mode and window setup
            let cb = ggez::ContextBuilder::new(simname.as_str(), author)
                .window_mode(w_mode)
                .window_setup(w_setup);
            // Print the simulation config
            println!("Running {} | {}x{} | {}px @ {} FPS", simname, grid_w, grid_h, cell_size, fps);
            // Build the context and event loop
            let (ctx, event_loop) = &mut cb.build()?;
            // Start the simulation event loop
            event::run(ctx, event_loop, simulation)
        },
        // Print an error and exit
        Err(err) => {
            eprintln!("[error] could not render simulation. {}", err);
            std::process::exit(0);
        }
    }        
}
fn rendersim < T : Automaton > ( automaton : & mut Result < Simulation < T > , ggez :: GameError > , grid_w : f32 , grid_h : f32 , cell_size : f32 , fps : u32 , author : & str ) -> ggez :: GameResult { use ggez :: { conf , event } ; // Check if the automaton has any errors match automaton { // Render the automaton Ok ( simulation ) => { // Get the name of the automaton let simname = simulation . automaton . name ( ) ; // Create ggez WindowMode. let w_mode : conf :: WindowMode = conf :: WindowMode :: default ( ) . dimensions ( grid_w , grid_h + 60.0 ) ; // Create ggez Window with the automaton name let w_setup = conf :: WindowSetup :: default ( ) . title ( simname . as_str ( ) ) ; // Create a ggez context with the window mode and window setup let cb = ggez :: ContextBuilder :: new ( simname . as_str ( ) , author ) . window_mode ( w_mode ) . window_setup ( w_setup ) ; // Print the simulation config println ! ( " " simname grid_w grid_h cell_size fps ) ; // Build the context and event loop let ( ctx , event_loop ) = & mut cb . build ( ) ? ; // Start the simulation event loop event :: run ( ctx , event_loop , simulation ) } , // Print an error and exit Err ( err ) => { eprintln ! ( " " err ) ; std :: process :: exit ( 0 ) ; } } }
A function that renders the simulation in a window
A function that renders the simulation in a window
automaton
&mut Result<Simulation<T>, ggez::GameError>
grid_w
f32
grid_h
f32
cell_size
f32
fps
u32
author
&str
automaton
&mut Result<Simulation<T>, ggez::GameError>
grid_w
f32
grid_h
f32
cell_size
f32
fps
u32
author
&str