Class: Airsprite::Rect
- Inherits:
-
Object
- Object
- Airsprite::Rect
- Defined in:
- lib/airsprite/base.rb
Instance Attribute Summary collapse
-
#height ⇒ Object
Returns the value of attribute height.
-
#width ⇒ Object
Returns the value of attribute width.
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Instance Method Summary collapse
- #area ⇒ Object
-
#initialize(width, height, offset_x, offset_y) ⇒ Rect
constructor
A new instance of Rect.
- #to_s ⇒ Object
Constructor Details
#initialize(width, height, offset_x, offset_y) ⇒ Rect
Returns a new instance of Rect.
150 151 152 153 154 155 |
# File 'lib/airsprite/base.rb', line 150 def initialize(width, height, offset_x, offset_y) @width = width @height = height @x = offset_x @y = offset_y end |
Instance Attribute Details
#height ⇒ Object
Returns the value of attribute height.
148 149 150 |
# File 'lib/airsprite/base.rb', line 148 def height @height end |
#width ⇒ Object
Returns the value of attribute width.
148 149 150 |
# File 'lib/airsprite/base.rb', line 148 def width @width end |
#x ⇒ Object
Returns the value of attribute x.
148 149 150 |
# File 'lib/airsprite/base.rb', line 148 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
148 149 150 |
# File 'lib/airsprite/base.rb', line 148 def y @y end |
Instance Method Details
#area ⇒ Object
157 158 159 |
# File 'lib/airsprite/base.rb', line 157 def area width * height end |
#to_s ⇒ Object
161 162 163 |
# File 'lib/airsprite/base.rb', line 161 def to_s "rect: #{width} x #{height} = #{area} (#{x}, #{y})" end |