Class: Vedeu::Canvas
- Inherits:
-
Object
- Object
- Vedeu::Canvas
- Includes:
- Singleton
- Defined in:
- lib/vedeu/geometry/canvas.rb
Overview
The size of the terminal is a limitation. Defining a canvas means we have more space to ‘do stuff’.
Instance Attribute Summary collapse
- #xn ⇒ Fixnum (also: #right, #width) readonly
- #yn ⇒ Fixnum (also: #bottom, #height) readonly
Class Method Summary collapse
Instance Method Summary collapse
- #c ⇒ Array (also: #centre)
- #configure(yn, xn) ⇒ Vedeu::Canvas
- #cx ⇒ Fixnum (also: #centre_x)
- #cy ⇒ Fixnum (also: #centre_y)
- #o ⇒ Fixnum (also: #origin)
- #x ⇒ Fixnum (also: #left)
- #y ⇒ Fixnum (also: #top)
Instance Attribute Details
#xn ⇒ Fixnum (readonly) Also known as: right, width
17 18 19 |
# File 'lib/vedeu/geometry/canvas.rb', line 17 def xn @xn end |
#yn ⇒ Fixnum (readonly) Also known as: bottom, height
11 12 13 |
# File 'lib/vedeu/geometry/canvas.rb', line 11 def yn @yn end |
Class Method Details
.canvas ⇒ Vedeu::Canvas
22 23 24 |
# File 'lib/vedeu/geometry/canvas.rb', line 22 def self.canvas instance end |
Instance Method Details
#c ⇒ Array Also known as: centre
37 38 39 |
# File 'lib/vedeu/geometry/canvas.rb', line 37 def c [cy, cx] end |
#configure(yn, xn) ⇒ Vedeu::Canvas
29 30 31 32 33 34 |
# File 'lib/vedeu/geometry/canvas.rb', line 29 def configure(yn, xn) @yn = yn @xn = xn self end |
#cx ⇒ Fixnum Also known as: centre_x
49 50 51 |
# File 'lib/vedeu/geometry/canvas.rb', line 49 def cx (width / 2) + x end |
#cy ⇒ Fixnum Also known as: centre_y
43 44 45 |
# File 'lib/vedeu/geometry/canvas.rb', line 43 def cy (height / 2) + y end |
#o ⇒ Fixnum Also known as: origin
55 56 57 |
# File 'lib/vedeu/geometry/canvas.rb', line 55 def o 1 end |
#x ⇒ Fixnum Also known as: left
77 78 79 |
# File 'lib/vedeu/geometry/canvas.rb', line 77 def x 1 end |
#y ⇒ Fixnum Also known as: top
71 72 73 |
# File 'lib/vedeu/geometry/canvas.rb', line 71 def y 1 end |