Module: EhbGameLib::Patches::Gosu::Font
- Defined in:
- lib/ehb_game_lib/patches/gosu/font.rb
Instance Method Summary collapse
-
#drawm(text, x, y, z, scale_x = 1, scale_y = 1, color = 0xff_ffffff, mode = :default) ⇒ Object
Draw text with line breaks.
- #text_height(text) ⇒ Object
- #text_width(text) ⇒ Object
Instance Method Details
#drawm(text, x, y, z, scale_x = 1, scale_y = 1, color = 0xff_ffffff, mode = :default) ⇒ Object
Draw text with line breaks.
8 9 10 11 12 13 |
# File 'lib/ehb_game_lib/patches/gosu/font.rb', line 8 def drawm(text, x, y, z, scale_x = 1, scale_y = 1, color = 0xff_ffffff, mode = :default) text.each_line do |line| draw(line.delete("\n"), x, y, z, scale_x, scale_y, color, mode) y += height end end |
#text_height(text) ⇒ Object
15 16 17 |
# File 'lib/ehb_game_lib/patches/gosu/font.rb', line 15 def text_height(text) text.lines.count * height end |
#text_width(text) ⇒ Object
19 20 21 |
# File 'lib/ehb_game_lib/patches/gosu/font.rb', line 19 def text_width(text) text.lines.map { |l| super(l) }.max end |