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