Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
kimonp committed Dec 22, 2023
1 parent 66ac799 commit 2ced1b0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,15 @@ fn fill_cells(context: &CanvasRenderingContext2d, cells: &[Cell], cell_type: Cel

// Every time we get a new animation frame, draw the grid, and advance the game.
//
// This includes the game itself (grid and cells) as well ad the
// This includes the game itself (grid and cells) as well as the
// frames per second widget.
pub fn update_frame_loop(universe: Rc<RefCell<Universe>>) {
let f = Rc::new(RefCell::new(None));
let g = f.clone();

let mut frames_per_second = FramesPerSecond::new("frames-per-second");

// Does not need to be FnMut if universe is behing a mutex
*g.borrow_mut() = Some(Closure::<dyn FnMut()>::new(move || {
*g.borrow_mut() = Some(Closure::new(move || {
frames_per_second.update_frame();
let id = request_animation_frame(f.borrow().as_ref().unwrap());

Expand Down

0 comments on commit 2ced1b0

Please sign in to comment.