Class: Hokusai::Commands::Text
- Defined in:
- ui/src/hokusai/commands/text.rb
Instance Attribute Summary collapse
-
#bold ⇒ Object
Returns the value of attribute bold.
-
#color ⇒ Object
Returns the value of attribute color.
-
#content ⇒ Object
Returns the value of attribute content.
-
#font ⇒ Object
Returns the value of attribute font.
-
#italic ⇒ Object
Returns the value of attribute italic.
-
#line_height ⇒ Object
Returns the value of attribute line_height.
-
#padding ⇒ Object
Returns the value of attribute padding.
-
#size ⇒ Object
Returns the value of attribute size.
-
#static ⇒ Object
Returns the value of attribute static.
-
#wrap ⇒ Object
readonly
Returns the value of attribute wrap.
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Instance Method Summary collapse
- #dynamic=(value) ⇒ Object
- #hash ⇒ Object
-
#initialize(content, x, y) ⇒ Text
constructor
A new instance of Text.
- #padding? ⇒ Boolean
Methods inherited from Base
#after_draw, draw, #draw, on_draw
Constructor Details
#initialize(content, x, y) ⇒ Text
Returns a new instance of Text.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'ui/src/hokusai/commands/text.rb', line 8 def initialize(content, x, y) @content = content @x = x.to_f @y = y.to_f @color = Color.new(0, 0, 0, 255) @padding = Padding.new(0.0, 0.0, 0.0, 0.0) @size = 17 @wrap = false @font = nil @static = true @bold = false @italic = false @line_height = 0.0 end |
Instance Attribute Details
#bold ⇒ Object
Returns the value of attribute bold.
3 4 5 |
# File 'ui/src/hokusai/commands/text.rb', line 3 def bold @bold end |
#color ⇒ Object
Returns the value of attribute color.
3 4 5 |
# File 'ui/src/hokusai/commands/text.rb', line 3 def color @color end |
#content ⇒ Object
Returns the value of attribute content.
3 4 5 |
# File 'ui/src/hokusai/commands/text.rb', line 3 def content @content end |
#font ⇒ Object
Returns the value of attribute font.
3 4 5 |
# File 'ui/src/hokusai/commands/text.rb', line 3 def font @font end |
#italic ⇒ Object
Returns the value of attribute italic.
3 4 5 |
# File 'ui/src/hokusai/commands/text.rb', line 3 def italic @italic end |
#line_height ⇒ Object
Returns the value of attribute line_height.
3 4 5 |
# File 'ui/src/hokusai/commands/text.rb', line 3 def line_height @line_height end |
#padding ⇒ Object
Returns the value of attribute padding.
3 4 5 |
# File 'ui/src/hokusai/commands/text.rb', line 3 def padding @padding end |
#size ⇒ Object
Returns the value of attribute size.
3 4 5 |
# File 'ui/src/hokusai/commands/text.rb', line 3 def size @size end |
#static ⇒ Object
Returns the value of attribute static.
3 4 5 |
# File 'ui/src/hokusai/commands/text.rb', line 3 def static @static end |
#wrap ⇒ Object (readonly)
Returns the value of attribute wrap.
3 4 5 |
# File 'ui/src/hokusai/commands/text.rb', line 3 def wrap @wrap end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
3 4 5 |
# File 'ui/src/hokusai/commands/text.rb', line 3 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
3 4 5 |
# File 'ui/src/hokusai/commands/text.rb', line 3 def y @y end |
Instance Method Details
#dynamic=(value) ⇒ Object
43 44 45 |
# File 'ui/src/hokusai/commands/text.rb', line 43 def dynamic=(value) @static = !value end |
#hash ⇒ Object
23 24 25 |
# File 'ui/src/hokusai/commands/text.rb', line 23 def hash [self.class, content, color.hash, padding.hash, size, font, wrap].hash end |
#padding? ⇒ Boolean
86 87 88 89 90 |
# File 'ui/src/hokusai/commands/text.rb', line 86 def padding? [padding.t, padding.r, padding.b, padding.l].any? do |p| p != 0.0 end end |