Class: Rectangle
- Inherits:
-
Object
- Object
- Rectangle
- Defined in:
- mrb_doc/models/rectangle.rb
Overview
The Rectangle class is used for drawing and also collision checking.
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#draw(origin: Vector2::ZERO, rotation: 0, outline: false, thickness: 2, rounded: false, radius: 5, segments: 8, colour: BLACK) ⇒ Rectangle
Draws a rectangle in several configurations.
-
#initialize(x, y, width, height) ⇒ Rectangle
constructor
Creates a new instance of Rectangle.
-
#to_h ⇒ Hash
Return the object represented by a Hash.
Constructor Details
Instance Attribute Details
#height ⇒ Integer
4 5 6 |
# File 'mrb_doc/models/rectangle.rb', line 4 def height @height end |
#width ⇒ Integer
4 5 6 |
# File 'mrb_doc/models/rectangle.rb', line 4 def width @width end |
#x ⇒ Integer
4 5 6 |
# File 'mrb_doc/models/rectangle.rb', line 4 def x @x end |
#y ⇒ Integer
4 5 6 |
# File 'mrb_doc/models/rectangle.rb', line 4 def y @y end |
Instance Method Details
#draw(origin: Vector2::ZERO, rotation: 0, outline: false, thickness: 2, rounded: false, radius: 5, segments: 8, colour: BLACK) ⇒ Rectangle
Draws a rectangle in several configurations
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'mrb_doc/models/rectangle.rb', line 63 def draw( origin: Vector2::ZERO, rotation: 0, outline: false, thickness: 2, rounded: false, radius: 5, segments: 8, colour: BLACK ) # src/mruby_integration/models/rectangle.cpp end |
#to_h ⇒ Hash
Return the object represented by a Hash
44 45 46 47 48 49 50 51 52 |
# File 'mrb_doc/models/rectangle.rb', line 44 def to_h # src/mruby_integration/models/rectangle.cpp { x: x, y: y, width: width, height: height, } end |