Class: MagicCloud::Shape
- Inherits:
-
Object
- Object
- MagicCloud::Shape
- Defined in:
- lib/magic_cloud/shape.rb
Overview
Basic “abstract shape” class, with all primitive functionality necessary for use it in Spriter and Layouter.
Word for wordcloud is inherited from it, and its potentially possible to inherit other types of shapes and layout them also.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#rect ⇒ Object
readonly
Returns the value of attribute rect.
-
#sprite ⇒ Object
Returns the value of attribute sprite.
-
#width ⇒ Object
readonly
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
- #bottom ⇒ Object
- #draw(_canvas) ⇒ Object
-
#initialize ⇒ Shape
constructor
A new instance of Shape.
- #left ⇒ Object
- #right ⇒ Object
- #top ⇒ Object
Constructor Details
#initialize ⇒ Shape
Returns a new instance of Shape.
10 11 12 13 14 15 16 17 |
# File 'lib/magic_cloud/shape.rb', line 10 def initialize @x = 0 @y = 0 @sprite = nil @rect = nil @width = 0 @height = 0 end |
Instance Attribute Details
#height ⇒ Object (readonly)
Returns the value of attribute height.
19 20 21 |
# File 'lib/magic_cloud/shape.rb', line 19 def height @height end |
#rect ⇒ Object (readonly)
Returns the value of attribute rect.
19 20 21 |
# File 'lib/magic_cloud/shape.rb', line 19 def rect @rect end |
#sprite ⇒ Object
Returns the value of attribute sprite.
19 20 21 |
# File 'lib/magic_cloud/shape.rb', line 19 def sprite @sprite end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
19 20 21 |
# File 'lib/magic_cloud/shape.rb', line 19 def width @width end |
#x ⇒ Object
Returns the value of attribute x.
19 20 21 |
# File 'lib/magic_cloud/shape.rb', line 19 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
19 20 21 |
# File 'lib/magic_cloud/shape.rb', line 19 def y @y end |
Instance Method Details
#bottom ⇒ Object
50 51 52 |
# File 'lib/magic_cloud/shape.rb', line 50 def bottom y + height end |
#draw(_canvas) ⇒ Object
54 55 56 |
# File 'lib/magic_cloud/shape.rb', line 54 def draw(_canvas) fail NotImplementedError end |
#left ⇒ Object
38 39 40 |
# File 'lib/magic_cloud/shape.rb', line 38 def left x end |
#right ⇒ Object
42 43 44 |
# File 'lib/magic_cloud/shape.rb', line 42 def right x + width end |
#top ⇒ Object
46 47 48 |
# File 'lib/magic_cloud/shape.rb', line 46 def top y end |