Class: Nuklear::UI::Label

Inherits:
Base
  • Object
show all
Includes:
TextAlign
Defined in:
lib/nuklear/ui/label.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TextAlign

#align_as_flags

Methods inherited from Base

descendants, #dsl, inherited

Methods included from Enableable

#disable, #disabled=, #disabled?, #enable, #enabled=, #enabled?

Methods included from Events

#event_listeners_for, #on, #trigger

Constructor Details

#initialize(text, color: nil, wrap: false, align: :left, **options) ⇒ Label

Returns a new instance of Label.



8
9
10
11
12
13
14
# File 'lib/nuklear/ui/label.rb', line 8

def initialize(text, color: nil, wrap: false, align: :left, **options)
  super(**options)
  self.text  = text
  self.color = color
  self.wrap  = wrap
  self.align = align
end

Instance Attribute Details

#alignObject

Returns the value of attribute align.



6
7
8
# File 'lib/nuklear/ui/label.rb', line 6

def align
  @align
end

#colorObject

Returns the value of attribute color.



6
7
8
# File 'lib/nuklear/ui/label.rb', line 6

def color
  @color
end

#textObject

Returns the value of attribute text.



6
7
8
# File 'lib/nuklear/ui/label.rb', line 6

def text
  @text
end

#wrapObject

Returns the value of attribute wrap.



6
7
8
# File 'lib/nuklear/ui/label.rb', line 6

def wrap
  @wrap
end

Instance Method Details

#to_commandObject



16
17
18
# File 'lib/nuklear/ui/label.rb', line 16

def to_command
  [:ui_label, text, color, wrap, align_as_flags(align)]
end