Class: RILabel

Inherits:
Object
  • Object
show all
Defined in:
lib/RIUI/RILabel.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ RILabel

Returns a new instance of RILabel.



3
4
5
6
7
8
9
10
11
# File 'lib/RIUI/RILabel.rb', line 3

def initialize(opts = {})
  @x = opts[:x] || 0
  @y = opts[:y] || 0
  @font = opts[:font] || ''
  @size = opts[:size] || 20
  @color = opts[:color] || 'black'
  @text = opts[:text] || 'RIUI Label'
  @label = Text.new(x: @x, y: @y, font: @font, size: @size, color: @color, text: @text)
end

Instance Attribute Details

#colorObject

Returns the value of attribute color.



2
3
4
# File 'lib/RIUI/RILabel.rb', line 2

def color
  @color
end

#fontObject

Returns the value of attribute font.



2
3
4
# File 'lib/RIUI/RILabel.rb', line 2

def font
  @font
end

#sizeObject

Returns the value of attribute size.



2
3
4
# File 'lib/RIUI/RILabel.rb', line 2

def size
  @size
end

#textObject

Returns the value of attribute text.



2
3
4
# File 'lib/RIUI/RILabel.rb', line 2

def text
  @text
end

#xObject

Returns the value of attribute x.



2
3
4
# File 'lib/RIUI/RILabel.rb', line 2

def x
  @x
end

#yObject

Returns the value of attribute y.



2
3
4
# File 'lib/RIUI/RILabel.rb', line 2

def y
  @y
end

Instance Method Details

#mouse_down_actions(x, y) ⇒ Object



19
# File 'lib/RIUI/RILabel.rb', line 19

def mouse_down_actions(x, y); end

#mouse_move_actions(x, y) ⇒ Object



20
# File 'lib/RIUI/RILabel.rb', line 20

def mouse_move_actions(x, y); end

#mouse_up_actionsObject



18
# File 'lib/RIUI/RILabel.rb', line 18

def mouse_up_actions; end

#setText(opts = [:text]) ⇒ Object



12
13
14
15
16
# File 'lib/RIUI/RILabel.rb', line 12

def setText(opts = [:text])
  @text = opts[:text]
  @label.remove
  @label = Text.new(x: @x, y: @y, font: @font, size: @size, color: @color, text: @text)
end

#update_actionsObject



17
# File 'lib/RIUI/RILabel.rb', line 17

def update_actions; end