Sha256: 758ea08a31a2f68bc8802dcbc27e944439ec93c5c98e58a08fbddbdc062788aa

Contents?: true

Size: 477 Bytes

Versions: 5

Compression:

Stored size: 477 Bytes

Contents

class FontStyle
  construct_with :resource_manager

  attr_accessor :font, :name, :size, :color, :x_scale, :y_scale
  def configure(name, size, color, x_scale, y_scale)
    @name = name
    @size = size
    @color = color
    @x_scale = x_scale
    @y_scale = y_scale
    reload
  end
  
  def calc_width(text)
    @font.text_width text if @font
  end
  
  def height
    @font.height if @font
  end
  
  def reload
    @font = resource_manager.load_font name, size
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gamebox-0.5.5 lib/gamebox/core/font_style.rb
gamebox-0.5.4 lib/gamebox/core/font_style.rb
gamebox-0.5.2 lib/gamebox/core/font_style.rb
gamebox-0.5.1 lib/gamebox/core/font_style.rb
gamebox-0.5.0 lib/gamebox/core/font_style.rb