Method: AuthorEngine::Part::GosuGraphics#text

Defined in:
lib/author_engine/game/gosu/parts/graphics.rb

#text(text, x = 0, y = 0, size = 4, z = 0, color = white) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/author_engine/game/gosu/parts/graphics.rb', line 8

def text(text, x = 0, y = 0, size = 4, z = 0, color = white)
  @authorengine_fonts ||= {}

  font = nil

  if @authorengine_fonts.dig(size)
    font = @authorengine_fonts.dig(size)
  else
    font = (@authorengine_fonts[size] = Gosu::Font.new(size, name: Text::FONT_DEFAULT))
  end

  font.draw_markup(text, x, y, z, 1, 1, color)
end