From 31d748601781c6f99ed2a19c209acab3542ea291 Mon Sep 17 00:00:00 2001 From: Thijs de Vries Date: Thu, 10 Nov 2011 16:12:46 -0500 Subject: [PATCH] use sleep instead of loop to lower cpu load --- lib/nyan/flight.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/nyan/flight.rb b/lib/nyan/flight.rb index d8d07bb..0e35154 100644 --- a/lib/nyan/flight.rb +++ b/lib/nyan/flight.rb @@ -27,14 +27,12 @@ def initialize(options = {}) @stage.add_sprite(@rainbow) @stage.add_sprite(@cat_head) @stage.add_sprite(@pop_tart) - @tick_time = Time.now end def next! maybe_add_a_twinkly_star @stage.play! - while Time.now - @tick_time < @framerate; end - @tick_time = Time.now + sleep(@framerate) end private