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.
| 9 10 11 12 13 14 15 16 | # File 'lib/magic_cloud/shape.rb', line 9 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.
| 18 19 20 | # File 'lib/magic_cloud/shape.rb', line 18 def height @height end | 
#rect ⇒ Object (readonly)
Returns the value of attribute rect.
| 18 19 20 | # File 'lib/magic_cloud/shape.rb', line 18 def rect @rect end | 
#sprite ⇒ Object
Returns the value of attribute sprite.
| 18 19 20 | # File 'lib/magic_cloud/shape.rb', line 18 def sprite @sprite end | 
#width ⇒ Object (readonly)
Returns the value of attribute width.
| 18 19 20 | # File 'lib/magic_cloud/shape.rb', line 18 def width @width end | 
#x ⇒ Object
Returns the value of attribute x.
| 18 19 20 | # File 'lib/magic_cloud/shape.rb', line 18 def x @x end | 
#y ⇒ Object
Returns the value of attribute y.
| 18 19 20 | # File 'lib/magic_cloud/shape.rb', line 18 def y @y end | 
Instance Method Details
#bottom ⇒ Object
| 49 50 51 | # File 'lib/magic_cloud/shape.rb', line 49 def bottom y + height end | 
#draw(_canvas) ⇒ Object
| 53 54 55 | # File 'lib/magic_cloud/shape.rb', line 53 def draw(_canvas) fail NotImplementedError end | 
#left ⇒ Object
| 37 38 39 | # File 'lib/magic_cloud/shape.rb', line 37 def left x end | 
#right ⇒ Object
| 41 42 43 | # File 'lib/magic_cloud/shape.rb', line 41 def right x + width end | 
#top ⇒ Object
| 45 46 47 | # File 'lib/magic_cloud/shape.rb', line 45 def top y end |