Module: CP::Constraint

Constant Summary collapse

PinJoint =

Alias for compatibility with chipmunk C-Ruby bindings.

CP::PinJoint
GearJoint =

Alias for compatibility with chipmunk C-Ruby bindings.

CP::GearJoint
PivotJoint =

Alias for compatibility with chipmunk C-Ruby bindings.

CP::PivotJoint
SlideJoint =

Alias for compatibility with chipmunk C-Ruby bindings.

CP::SlideJoint
GrooveJoint =

Alias for compatibility with chipmunk C-Ruby bindings.

CP::GrooveJoint
SimpleMotor =

Alias for compatibility with chipmunk C-Ruby bindings.

CP::SimpleMotor
DampedSpring =

Alias for compatibility with chipmunk C-Ruby bindings.

CP::DampedSpring
RatchetJoint =

Alias for compatibility with chipmunk C-Ruby bindings.

CP::RatchetJoint
RotaryLimitJoint =

Alias for compatibility with chipmunk C-Ruby bindings.

CP::RotaryLimitJoint
DampedRotarySpring =

Alias for compatibility with chipmunk C-Ruby bindings.

CP::DampedRotarySpring

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#body_aObject (readonly)

Returns the value of attribute body_a.



25
26
27
# File 'lib/chipmunk-ffi/constraint.rb', line 25

def body_a
  @body_a
end

#body_bObject (readonly)

Returns the value of attribute body_b.



25
26
27
# File 'lib/chipmunk-ffi/constraint.rb', line 25

def body_b
  @body_b
end

#structObject (readonly)

Returns the value of attribute struct.



25
26
27
# File 'lib/chipmunk-ffi/constraint.rb', line 25

def struct
  @struct
end

Class Method Details

.included(other) ⇒ Object



31
32
33
34
# File 'lib/chipmunk-ffi/constraint.rb', line 31

def self.included(other)
  super
  other.class_eval { extend StructAccessor }
end

Instance Method Details

#set_data_pointerObject



36
37
38
39
40
41
42
# File 'lib/chipmunk-ffi/constraint.rb', line 36

def set_data_pointer
  mem = FFI::MemoryPointer.new(:long)
  mem.put_long 0, object_id
  # this is needed to prevent data corruption by GC
  @constraint_pointer = mem
  @struct.constraint.data = mem
end