Class: AuthorEngine::Text
- Inherits:
-
Object
- Object
- AuthorEngine::Text
- Includes:
- Support
- Defined in:
- lib/author_engine/text.rb
Constant Summary collapse
- FONT_DEFAULT =
"#{File.("../../../", __FILE__)}/assets/fonts/Connection.otf"
- FONT_DEFAULT_BOLD =
"#{File.("../../../", __FILE__)}/assets/fonts/ConnectionBold.otf"
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#font ⇒ Object
readonly
Returns the value of attribute font.
-
#message ⇒ Object
Returns the value of attribute message.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
-
#z ⇒ Object
Returns the value of attribute z.
Instance Method Summary collapse
- #draw ⇒ Object
- #draw_markup ⇒ Object
- #height ⇒ Object
-
#initialize(message: "", size: nil, x: 0, y: 0, z: 0, color: Gosu::Color::WHITE, font: FONT_DEFAULT) ⇒ Text
constructor
Consolas.
- #update ⇒ Object
- #width ⇒ Object
- #width_markup ⇒ Object
Methods included from Support
#code_editor, #mouse_over?, #sprite_editor, #window
Constructor Details
#initialize(message: "", size: nil, x: 0, y: 0, z: 0, color: Gosu::Color::WHITE, font: FONT_DEFAULT) ⇒ Text
Consolas
9 10 11 12 13 14 15 16 |
# 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 = @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 |
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
7 8 9 |
# File 'lib/author_engine/text.rb', line 7 def color @color end |
#font ⇒ Object (readonly)
Returns the value of attribute font.
8 9 10 |
# File 'lib/author_engine/text.rb', line 8 def font @font end |
#message ⇒ Object
Returns the value of attribute message.
7 8 9 |
# File 'lib/author_engine/text.rb', line 7 def @message end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
8 9 10 |
# File 'lib/author_engine/text.rb', line 8 def size @size end |
#x ⇒ Object
Returns the value of attribute x.
7 8 9 |
# File 'lib/author_engine/text.rb', line 7 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
7 8 9 |
# File 'lib/author_engine/text.rb', line 7 def y @y end |
#z ⇒ Object
Returns the value of attribute z.
7 8 9 |
# File 'lib/author_engine/text.rb', line 7 def z @z end |
Instance Method Details
#draw ⇒ Object
30 31 32 |
# File 'lib/author_engine/text.rb', line 30 def draw @font.draw_text(@message, @x, @y, @z, 1, 1, @color) end |
#draw_markup ⇒ Object
34 35 36 |
# File 'lib/author_engine/text.rb', line 34 def draw_markup @font.draw_markup(@message, @x, @y, @z, 1, 1, @color) end |
#height ⇒ Object
26 27 28 |
# File 'lib/author_engine/text.rb', line 26 def height @font.height end |
#update ⇒ Object
38 39 |
# File 'lib/author_engine/text.rb', line 38 def update end |
#width ⇒ Object
18 19 20 |
# File 'lib/author_engine/text.rb', line 18 def width @font.text_width(@message) end |
#width_markup ⇒ Object
22 23 24 |
# File 'lib/author_engine/text.rb', line 22 def width_markup @font.markup_width(@message) end |