Class: Text
- Inherits:
-
Object
- Object
- Text
- Defined in:
- lib/text.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#font ⇒ Object
Returns the value of attribute font.
-
#horizontal ⇒ Object
Returns the value of attribute horizontal.
-
#value ⇒ Object
Returns the value of attribute value.
-
#vertical ⇒ Object
Returns the value of attribute vertical.
-
#window ⇒ Object
Returns the value of attribute window.
Instance Method Summary collapse
- #draw ⇒ Object
- #horizon ⇒ Object
-
#initialize(window, val, font, v, h, color = 0xffffff00) ⇒ Text
constructor
A new instance of Text.
- #vert ⇒ Object
Constructor Details
#initialize(window, val, font, v, h, color = 0xffffff00) ⇒ Text
Returns a new instance of Text.
4 5 6 7 8 9 10 11 |
# File 'lib/text.rb', line 4 def initialize window, val, font, v, h, color = 0xffffff00 self.window = window self.value = val self.font = font self.color = color self.vertical = v self.horizontal = h end |
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
2 3 4 |
# File 'lib/text.rb', line 2 def color @color end |
#font ⇒ Object
Returns the value of attribute font.
2 3 4 |
# File 'lib/text.rb', line 2 def font @font end |
#horizontal ⇒ Object
Returns the value of attribute horizontal.
2 3 4 |
# File 'lib/text.rb', line 2 def horizontal @horizontal end |
#value ⇒ Object
Returns the value of attribute value.
2 3 4 |
# File 'lib/text.rb', line 2 def value @value end |
#vertical ⇒ Object
Returns the value of attribute vertical.
2 3 4 |
# File 'lib/text.rb', line 2 def vertical @vertical end |
#window ⇒ Object
Returns the value of attribute window.
2 3 4 |
# File 'lib/text.rb', line 2 def window @window end |
Instance Method Details
#draw ⇒ Object
21 22 23 |
# File 'lib/text.rb', line 21 def draw font.draw value, horizon, vert, 1.0, 1.0, 1.0, color end |
#horizon ⇒ Object
17 18 19 |
# File 'lib/text.rb', line 17 def horizon (horizontal == :left) ? 10 : window.width - font.text_width(value) - 10 end |
#vert ⇒ Object
13 14 15 |
# File 'lib/text.rb', line 13 def vert (vertical == :top) ? 10 : window.height - font.height - 5 end |