Sha256: d10314128688a41449a42c088c559542ebdbacdb5cb6db8f9bc365345db185e6
Contents?: true
Size: 589 Bytes
Versions: 4
Compression:
Stored size: 589 Bytes
Contents
module Lotu class FpsSystem def initialize(user, opts={}) default_opts = { :ticks_per_update => 10 } opts = default_opts.merge!(opts) @accum = 0.0 @ticks = 0 @fps = 0.0 @ticks_per_update = opts[:ticks_per_update] end def update @ticks += 1 @accum += $lotu.dt if @ticks >= @ticks_per_update @fps = @ticks/@accum @ticks = 0 @accum = 0.0 end end def to_s "Ticks per update: #{@ticks_per_update} | FPS: #{format("%.2f",@fps)}" end def draw;end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
lotu-0.1.14 | lib/lotu/systems/fps_system.rb |
lotu-0.1.13 | lib/lotu/systems/fps_system.rb |
lotu-0.1.12 | lib/lotu/systems/fps_system.rb |
lotu-0.1.11 | lib/lotu/systems/fps_system.rb |