Class: Rect

Inherits:
Object
  • Object
show all
Defined in:
lib/amun/primitives/rect.rb

Overview

a primitive class that incapsulate a rectangle on screen, with position (top, left) and size (width, height)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Rect

create a rectangle with top, left, width and height

opts(Hash)

a hash with keys (top, left, width, height)



9
10
11
12
13
14
# File 'lib/amun/primitives/rect.rb', line 9

def initialize(opts = {})
  @top = opts[:top]
  @left = opts[:left]
  @width = opts[:width]
  @height = opts[:height]
end

Instance Attribute Details

#heightObject (readonly)

Returns the value of attribute height.



5
6
7
# File 'lib/amun/primitives/rect.rb', line 5

def height
  @height
end

#leftObject (readonly)

Returns the value of attribute left.



5
6
7
# File 'lib/amun/primitives/rect.rb', line 5

def left
  @left
end

#topObject (readonly)

Returns the value of attribute top.



5
6
7
# File 'lib/amun/primitives/rect.rb', line 5

def top
  @top
end

#widthObject (readonly)

Returns the value of attribute width.



5
6
7
# File 'lib/amun/primitives/rect.rb', line 5

def width
  @width
end