Class: FontStyle

Inherits:
Object show all
Defined in:
lib/gamebox/core/font_style.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#colorObject

Returns the value of attribute color.



5
6
7
# File 'lib/gamebox/core/font_style.rb', line 5

def color
  @color
end

#fontObject

Returns the value of attribute font.



5
6
7
# File 'lib/gamebox/core/font_style.rb', line 5

def font
  @font
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/gamebox/core/font_style.rb', line 5

def name
  @name
end

#sizeObject

Returns the value of attribute size.



5
6
7
# File 'lib/gamebox/core/font_style.rb', line 5

def size
  @size
end

#x_scaleObject

Returns the value of attribute x_scale.



5
6
7
# File 'lib/gamebox/core/font_style.rb', line 5

def x_scale
  @x_scale
end

#y_scaleObject

Returns the value of attribute y_scale.



5
6
7
# File 'lib/gamebox/core/font_style.rb', line 5

def y_scale
  @y_scale
end

Instance Method Details

#calc_width(text) ⇒ Object



15
16
17
# File 'lib/gamebox/core/font_style.rb', line 15

def calc_width(text)
  @font.text_width text if @font
end

#configure(name, size, color, x_scale, y_scale) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/gamebox/core/font_style.rb', line 6

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

#heightObject



19
20
21
# File 'lib/gamebox/core/font_style.rb', line 19

def height
  @font.height if @font
end

#reloadObject



23
24
25
# File 'lib/gamebox/core/font_style.rb', line 23

def reload
  @font = resource_manager.load_font name, size
end