Class: UI::Point
- Inherits:
-
Object
- Object
- UI::Point
- Defined in:
- lib/ektoplayer/ui.rb
Instance Attribute Summary collapse
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Instance Method Summary collapse
- #<=(p) ⇒ Object
- #==(p) ⇒ Object
- #>=(p) ⇒ Object
- #calc(x: 0, y: 0) ⇒ Object
-
#initialize(x: 0, y: 0) ⇒ Point
constructor
A new instance of Point.
- #to_s ⇒ Object
- #update(x: nil, y: nil) ⇒ Object
Constructor Details
#initialize(x: 0, y: 0) ⇒ Point
Returns a new instance of Point.
211 212 213 |
# File 'lib/ektoplayer/ui.rb', line 211 def initialize(x: 0, y: 0) @x, @y = x, y end |
Instance Attribute Details
#x ⇒ Object
Returns the value of attribute x.
209 210 211 |
# File 'lib/ektoplayer/ui.rb', line 209 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
209 210 211 |
# File 'lib/ektoplayer/ui.rb', line 209 def y @y end |
Instance Method Details
#<=(p) ⇒ Object
224 |
# File 'lib/ektoplayer/ui.rb', line 224 def <=(p) @x <= p.x and @y <= p.y end |
#==(p) ⇒ Object
225 |
# File 'lib/ektoplayer/ui.rb', line 225 def ==(p) @x == p.x and @y == p.y end |
#>=(p) ⇒ Object
223 |
# File 'lib/ektoplayer/ui.rb', line 223 def >=(p) @x >= p.x and @y >= p.y end |
#calc(x: 0, y: 0) ⇒ Object
219 220 221 |
# File 'lib/ektoplayer/ui.rb', line 219 def calc(x: 0, y: 0) Point.new(x: @x + x, y: @y + y) end |
#to_s ⇒ Object
226 |
# File 'lib/ektoplayer/ui.rb', line 226 def to_s; "[(Point) x=#{x}, y=#{y}]" end |