Class: Text

Inherits:
Object
  • Object
show all
Defined in:
lib/r2d/text.rb

Overview

text.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x = 0, y = 0, h = 50, content = "Hello World!", c = "white", visible = true) ⇒ Text

Returns a new instance of Text.



8
9
10
11
12
13
# File 'lib/r2d/text.rb', line 8

def initialize(x=0, y=0, h=50, content="Hello World!", c="white", visible=true)
  @x, @y, @h, @content, @color = x, y, h, content, c
  update_color(c)
  @text = R2D::Adapters.text(h)
  if visible then add end
end

Instance Attribute Details

#cObject (readonly)

Returns the value of attribute c.



6
7
8
# File 'lib/r2d/text.rb', line 6

def c
  @c
end

#colorObject

Returns the value of attribute color.



6
7
8
# File 'lib/r2d/text.rb', line 6

def color
  @color
end

#contentObject

Returns the value of attribute content.



6
7
8
# File 'lib/r2d/text.rb', line 6

def content
  @content
end

#hObject (readonly)

Returns the value of attribute h.



6
7
8
# File 'lib/r2d/text.rb', line 6

def h
  @h
end

#xObject

Returns the value of attribute x.



5
6
7
# File 'lib/r2d/text.rb', line 5

def x
  @x
end

#yObject

Returns the value of attribute y.



5
6
7
# File 'lib/r2d/text.rb', line 5

def y
  @y
end

Instance Method Details

#adapterObject



32
33
34
# File 'lib/r2d/text.rb', line 32

def adapter
  @text
end

#addObject



24
25
26
# File 'lib/r2d/text.rb', line 24

def add
  R2D::Window.add(self)
end

#removeObject



28
29
30
# File 'lib/r2d/text.rb', line 28

def remove
  R2D::Window.remove(self)
end