Module: Ruby2D::Renderable
- Defined in:
- lib/ruby2d/renderable.rb
Overview
Base class for all renderable shapes
Instance Attribute Summary collapse
-
#color ⇒ Object
(also: #colour)
Returns the value of attribute color.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
-
#z ⇒ Object
Returns the value of attribute z.
Instance Method Summary collapse
-
#add ⇒ Object
Add the object to the window.
-
#contains?(x, y) ⇒ Boolean
Add a contains method stub.
-
#remove ⇒ Object
Remove the object from the window.
Instance Attribute Details
#color ⇒ Object Also known as: colour
Returns the value of attribute color.
8 9 10 |
# File 'lib/ruby2d/renderable.rb', line 8 def color @color end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
8 9 10 |
# File 'lib/ruby2d/renderable.rb', line 8 def height @height end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
8 9 10 |
# File 'lib/ruby2d/renderable.rb', line 8 def width @width end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
8 9 10 |
# File 'lib/ruby2d/renderable.rb', line 8 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
8 9 10 |
# File 'lib/ruby2d/renderable.rb', line 8 def y @y end |
#z ⇒ Object
Returns the value of attribute z.
8 9 10 |
# File 'lib/ruby2d/renderable.rb', line 8 def z @z end |
Instance Method Details
#add ⇒ Object
Add the object to the window
18 19 20 |
# File 'lib/ruby2d/renderable.rb', line 18 def add Window.add(self) end |
#contains?(x, y) ⇒ Boolean
Add a contains method stub
37 38 39 |
# File 'lib/ruby2d/renderable.rb', line 37 def contains?(x, y) x >= @x && x <= (@x + @width) && y >= @y && y <= (@y + @height) end |