Module: CP::Object

Included in:
Body, Constraint, Shape
Defined in:
lib/chipmunk.rb

Overview

Chipmunk Object Makes it easier to manage complex objects that reference many primitive Chipmunk objects such as bodies shapes and constraints. New composite objects simply need to include CP::Object and call init_chipmunk_object(*objects) with the composite and primitive Chipmunk objects that make up itself.

Instance Method Summary collapse

Instance Method Details

#chipmunk_objectsObject

Returns the list of primitive Chipmunk objects (bodies, shapes and constraints that this composite object references directly and indirectly.


21
22
23
24
25
26
27
# File 'lib/chipmunk.rb', line 21

def chipmunk_objects
  if @chipmunk_objects
    return @chipmunk_objects
  else
    raise "This CP::Object (#{self.class}) did not call #init_chipmunk_object."
  end
end