Class: Conjuration::Text
- Inherits:
-
GameObject
- Object
- GameObject
- Conjuration::Text
- Defined in:
- lib/conjuration/ui/text.rb
Instance Method Summary collapse
- #draw(window, scene) ⇒ Object
-
#initialize(x:, y:, text:, font_size: 20, color: Gosu::Color::BLACK) ⇒ Text
constructor
A new instance of Text.
Methods inherited from GameObject
create, #in_bounds?, #mouse_down, #mouse_entered, #mouse_exited, #mouse_position, #mouse_up, #on_click, #on_mouse_down, #on_mouse_up
Methods included from Attributes
Constructor Details
#initialize(x:, y:, text:, font_size: 20, color: Gosu::Color::BLACK) ⇒ Text
Returns a new instance of Text.
3 4 5 6 7 8 9 10 |
# File 'lib/conjuration/ui/text.rb', line 3 def initialize(x:, y:, text:, font_size: 20, color: Gosu::Color::BLACK) @font = Gosu::Font.new(font_size) super(x:, y:, width: @font.text_width(text), height: @font.height) @text = text @color = color end |
Instance Method Details
#draw(window, scene) ⇒ Object
12 13 14 |
# File 'lib/conjuration/ui/text.rb', line 12 def draw(window, scene) @font.draw_text(@text, x, y, 1, 1, 1, @color) end |