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.
6 7 8 9 10 11 |
# File 'lib/ehb_game_lib/patches/gosu/font.rb', line 6 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
13 14 15 |
# File 'lib/ehb_game_lib/patches/gosu/font.rb', line 13 def text_height(text) text.lines.count * height end |
#text_width(text) ⇒ Object
17 18 19 |
# File 'lib/ehb_game_lib/patches/gosu/font.rb', line 17 def text_width(text) text.lines.map { |l| super(l) }.max end |