class AuthorEngine::Text

Constants

FONT_DEFAULT
FONT_DEFAULT_BOLD

Attributes

color[RW]
font[R]
message[RW]
size[R]
x[RW]
y[RW]
z[RW]

Public Class Methods

new(message: "", size: nil, x: 0, y: 0, z: 0, color: Gosu::Color::WHITE, font: FONT_DEFAULT) click to toggle source
# File lib/author_engine/text.rb, line 9
def initialize(message: "", size: nil, x: 0, y: 0, z: 0, color: Gosu::Color::WHITE, font: FONT_DEFAULT) # Consolas
  @message = message
  @size = size ? size : (8 * window.scale_y).floor
  @x, @y, @z = x, y, z
  @color, @font_name = color, font

  @font = Gosu::Font.new(@size, name: @font_name)
end

Public Instance Methods

draw() click to toggle source
# File lib/author_engine/text.rb, line 30
def draw
  @font.draw_text(@message, @x, @y, @z, 1, 1, @color)
end
draw_markup() click to toggle source
# File lib/author_engine/text.rb, line 34
def draw_markup
  @font.draw_markup(@message, @x, @y, @z, 1, 1, @color)
end
height() click to toggle source
# File lib/author_engine/text.rb, line 26
def height
  @font.height
end
update() click to toggle source
# File lib/author_engine/text.rb, line 38
def update
end
width() click to toggle source
# File lib/author_engine/text.rb, line 18
def width
  @font.text_width(@message)
end
width_markup() click to toggle source
# File lib/author_engine/text.rb, line 22
def width_markup
  @font.markup_width(@message)
end