Class: Ruby2D::Square
Overview
A square
Instance Attribute Summary collapse
-
#size ⇒ Object
Returns the value of attribute size.
Attributes inherited from Quad
#x1, #x2, #x3, #x4, #y1, #y2, #y3, #y4
Attributes included from Renderable
#color, #height, #width, #x, #y, #z
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(x: 0, y: 0, size: 100, z: 0, color: nil, colour: nil, opacity: nil) ⇒ Square
constructor
Create an square.
Methods inherited from Rectangle
#contains?, #height=, #width=, #x=, #y=
Methods inherited from Quad
Methods included from Renderable
Constructor Details
#initialize(x: 0, y: 0, size: 100, z: 0, color: nil, colour: nil, opacity: nil) ⇒ Square
Create an square
18 19 20 21 22 |
# File 'lib/ruby2d/square.rb', line 18 def initialize(x: 0, y: 0, size: 100, z: 0, color: nil, colour: nil, opacity: nil) @size = size super(x: x, y: y, width: size, height: size, z: z, color: color, colour: colour, opacity: opacity) end |
Instance Attribute Details
#size ⇒ Object
Returns the value of attribute size.
8 9 10 |
# File 'lib/ruby2d/square.rb', line 8 def size @size end |
Class Method Details
.draw(x:, y:, size:, color:) ⇒ Object
29 30 31 32 33 |
# File 'lib/ruby2d/square.rb', line 29 def self.draw(x:, y:, size:, color:) super(x: x, y: y, width: size, height: size, color: color) end |