Sha256: 1215ca9db0410cd2e83ea3b04222bab4928c9df9b81909ab74a3aebff0ca5090

Contents?: true

Size: 470 Bytes

Versions: 4

Compression:

Stored size: 470 Bytes

Contents

class FpsView < ActorView
  def draw(target,x_off,y_off)
    text = @actor.fps.to_s
    text = '0'*(6-text.size)+text if text.size < 6

    font = @stage.resource_manager.load_font 'Asimov.ttf', 30
    text_image = font.render text, true, [250,250,250,255]

    x = @actor.x
    y = @actor.y

    text_image.blit target.screen, [x,y]
  end
end
class Fps < Actor

  has_behavior :layered => {:layer => 999}

  def fps
    input_manager.current_framerate.round
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gamebox-0.3.2 lib/gamebox/actors/fps.rb
gamebox-0.2.1 lib/gamebox/actors/fps.rb
gamebox-0.1.1 lib/gamebox/actors/fps.rb
gamebox-0.1.0 lib/gamebox/actors/fps.rb