Class: Gosu::Font
- Inherits:
-
Object
- Object
- Gosu::Font
- Defined in:
- lib/gosu_android/graphics/font.rb
Instance Attribute Summary collapse
-
#flags ⇒ Object
readonly
Returns the value of attribute flags.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#draw(text, x, y, z, factor_x = 1, factor_y = 1, c = Color::WHITE, mode = :default) ⇒ Object
Draws text so the top left corner of the text is at (x; y).
- #height ⇒ Object
-
#initialize(window, font_name, font_height, font_flags = :ff_bold) ⇒ Font
constructor
A new instance of Font.
Constructor Details
#initialize(window, font_name, font_height, font_flags = :ff_bold) ⇒ Font
Returns a new instance of Font.
30 31 32 33 34 35 36 |
# File 'lib/gosu_android/graphics/font.rb', line 30 def initialize(window, font_name, font_height, font_flags = :ff_bold) @window = window @fonts_manager = window.fonts_manager @name = font_name @height = font_height * 2 @flags = flags end |
Instance Attribute Details
#flags ⇒ Object (readonly)
Returns the value of attribute flags.
29 30 31 |
# File 'lib/gosu_android/graphics/font.rb', line 29 def flags @flags end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
29 30 31 |
# File 'lib/gosu_android/graphics/font.rb', line 29 def name @name end |
Instance Method Details
#draw(text, x, y, z, factor_x = 1, factor_y = 1, c = Color::WHITE, mode = :default) ⇒ Object
Draws text so the top left corner of the text is at (x; y). param text Formatted text without line-breaks.
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/gosu_android/graphics/font.rb', line 44 def draw(text, x, y, z, factor_x = 1, factor_y = 1, c = Color::WHITE, mode = :default) offset = 0 text.each_char do |char| (@fonts_manager.getSymbol char ).draw(x + offset, y, z, factor_x, factor_y, c, mode) offset += 10 end end |
#height ⇒ Object
38 39 40 |
# File 'lib/gosu_android/graphics/font.rb', line 38 def height @height / 2 end |