Method: Dare::Window#run!

Defined in:
lib/dare/window.rb

#run!Object

starts the game loop for the window.



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/dare/window.rb', line 34

def run!
  %x{
    function anim_loop() {
      requestAnimationFrame(anim_loop);
      #{update};
      #{@canvas.context}.clearRect(0, 0, #{width}, #{height});
      #{draw};
    }
    requestAnimationFrame(anim_loop);
  }
end