Sha256: ebbf30b1aaaae57eb77da12a023c4d284149e90f65e777954b842a61f0a06d93
Contents?: true
Size: 500 Bytes
Versions: 1
Compression:
Stored size: 500 Bytes
Contents
module CyberarmEngine class Timer def initialize(interval, looping = true, &block) @interval = interval @looping = looping @block = block @last_interval = Gosu.milliseconds @triggered = false end def update return if !@looping && @triggered if Gosu.milliseconds >= @last_interval + @interval @last_interval = Gosu.milliseconds @triggered = true @block.call if @block end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cyberarm_engine-0.13.0 | lib/cyberarm_engine/timer.rb |