Class: Ray::Polygon::Point

Inherits:
Object
  • Object
show all
Defined in:
lib/ray/polygon.rb

Overview

One of the points contained in a polygon.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(polygon, id) ⇒ Point

Returns a new instance of Point.



7
8
9
# File 'lib/ray/polygon.rb', line 7

def initialize(polygon, id)
  @polygon, @id = polygon, id
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



46
47
48
# File 'lib/ray/polygon.rb', line 46

def id
  @id
end

#polygonObject (readonly)

Returns the value of attribute polygon.



46
47
48
# File 'lib/ray/polygon.rb', line 46

def polygon
  @polygon
end

Instance Method Details

#colorColor

Returns Color of the point.

Returns:

  • (Color)

    Color of the point



17
18
19
# File 'lib/ray/polygon.rb', line 17

def color
  @polygon.color_of(@id)
end

#color=(color) ⇒ Object

Sets the color of the point



32
33
34
# File 'lib/ray/polygon.rb', line 32

def color=(color)
  @polygon.set_color_of(@id, color)
end

#inspectObject



41
42
43
44
# File 'lib/ray/polygon.rb', line 41

def inspect
  "#<#{self.class} polygon=#{polygon} id=#{id} pos=#{pos} color=#{color} \
outline=#{outline}>"
end

#outlineColor

Returns Outline color of the point.

Returns:

  • (Color)

    Outline color of the point



22
23
24
# File 'lib/ray/polygon.rb', line 22

def outline
  @polygon.outline_of(@id)
end

#outline=(outline) ⇒ Object

Sets the outline color of the point



37
38
39
# File 'lib/ray/polygon.rb', line 37

def outline=(outline)
  @polygon.set_outline_of(@id, outline)
end

#posRay::Vector2

Returns Position of the point.

Returns:



12
13
14
# File 'lib/ray/polygon.rb', line 12

def pos
  @polygon.pos_of(@id)
end

#pos=(pos) ⇒ Object

Sets the position of the point



27
28
29
# File 'lib/ray/polygon.rb', line 27

def pos=(pos)
  @polygon.set_pos_of(@id, pos)
end