Class: CP::Shape::Circle

Inherits:
Object
  • Object
show all
Includes:
CP::Shape
Defined in:
lib/chipmunk-ffi/shape.rb,
lib/chipmunk-ffi/unsafe.rb

Instance Attribute Summary

Attributes included from CP::Shape

#struct

Instance Method Summary collapse

Methods included from CP::Shape

#bb, #body, #body=, #cache_bb, #collision_type, #collision_type=, #data, #data=, #e, #e=, #group, #group=, #layers, #layers=, #point_query, reset_id_counter, #segment_query, #sensor=, #sensor?, #set_data_pointer, #surface_v, #surface_v=, #u, #u=

Constructor Details

#initialize(body, rad, offset_vec) ⇒ Circle

Returns a new instance of Circle.



184
185
186
187
188
189
# File 'lib/chipmunk-ffi/shape.rb', line 184

def initialize(body, rad, offset_vec)
  @body = body
  ptr = CP.cpCircleShapeNew body.struct.pointer, rad, offset_vec.struct
  @struct = ShapeStruct.new ptr
  set_data_pointer
end

Instance Method Details

#offset=(new_offset) ⇒ Object



17
18
19
# File 'lib/chipmunk-ffi/unsafe.rb', line 17

def offset=(new_offset)
  CP.cpCircleShapeSetOffset(@struct, new_offset.struct)
end

#radius=(new_radius) ⇒ Object



14
15
16
# File 'lib/chipmunk-ffi/unsafe.rb', line 14

def radius=(new_radius)
  CP.cpCircleShapeSetRadius(@struct, new_radius)
end