Example #1
0
void
Init_chipmunk(void)
{
	id_parent = rb_intern("parent");
	
	cpInitChipmunk();
	
	rb_eval_string("Float::INFINITY = 1.0/0.0");
	
	m_Chipmunk = rb_define_module("CP");
	rb_define_module_function(m_Chipmunk, "bias_coef", rb_get_cp_bias_coef, 0);
	rb_define_module_function(m_Chipmunk, "bias_coef=", rb_set_cp_bias_coef, 1);
	rb_define_module_function(m_Chipmunk, "collision_slop", rb_get_cp_collision_slop, 0);
	rb_define_module_function(m_Chipmunk, "collision_slop=", rb_set_cp_collision_slop, 1);
	
	rb_define_module_function(m_Chipmunk, "moment_for_circle", rb_momentForCircle, 4);
	rb_define_module_function(m_Chipmunk, "moment_for_poly", rb_momentForPoly, 3);
	// TODO add seg moment function
	
	Init_cpVect();
	Init_cpBB();
	Init_cpBody();
	Init_cpShape();
	Init_cpConstraint();
	Init_cpSpace();
}
Example #2
0
void
Init_chipmunk(void)
{
	id_parent = rb_intern("parent");
	
	cpInitChipmunk();
	
	m_Chipmunk = rb_define_module("CP");
	rb_define_module_function(m_Chipmunk, "bias_coef", rb_get_cp_bias_coef, 0);
	rb_define_module_function(m_Chipmunk, "bias_coef=", rb_set_cp_bias_coef, 1);
	rb_define_module_function(m_Chipmunk, "collision_slop", rb_get_cp_collision_slop, 0);
	rb_define_module_function(m_Chipmunk, "collision_slop=", rb_set_cp_collision_slop, 1);
	
	rb_define_module_function(m_Chipmunk, "moment_for_circle", rb_momentForCircle, 4);
	rb_define_module_function(m_Chipmunk, "moment_for_poly", rb_momentForPoly, 3);
	
	rb_define_module_function(m_Chipmunk, "damped_spring", rb_dampedSpring, 8);
	
	Init_cpVect();
	Init_cpBB();
	Init_cpBody();
	Init_cpShape();
	Init_cpJoint();
	Init_cpSpace();
}
Example #3
0
void
Init_chipmunk(void)
{
    id_parent = rb_intern("parent");

    cpInitChipmunk();

    rb_eval_string("Float::INFINITY = 1.0/0.0");

    m_Chipmunk = rb_define_module("CP");
    rb_define_module_function(m_Chipmunk, "bias_coef",
                              rb_get_cp_bias_coef, 0);
    rb_define_module_function(m_Chipmunk, "bias_coef=",
                              rb_set_cp_bias_coef, 1);
    rb_define_module_function(m_Chipmunk, "collision_slop",
                              rb_get_cp_collision_slop, 0);
    rb_define_module_function(m_Chipmunk, "collision_slop=",
                              rb_set_cp_collision_slop, 1);
    rb_define_module_function(m_Chipmunk, "moment_for_circle",
                              rb_momentForCircle, 4);
    rb_define_module_function(m_Chipmunk, "moment_for_poly",
                              rb_momentForPoly, 3);
    rb_define_module_function(m_Chipmunk, "moment_for_segment",
                              rb_momentForSegment, 3);
    rb_define_const(m_Chipmunk, "INFINITY", rb_float_new(INFINITY));
    rb_define_const(m_Chipmunk, "VERSION" ,
                    rb_str_new2(cpVersionString));

    Init_cpVect();
    Init_cpArbiter();
    Init_cpBB();
    Init_cpBody();
    Init_cpShape();
    Init_cpConstraint();
    Init_cpSpace();

}
Example #4
0
void
Init_chipmunk(void) {
  id_parent  = rb_intern("parent");

  cpInitChipmunk();



  m_Chipmunk = rb_define_module("CP");
  rb_define_module_function(m_Chipmunk, "bias_coef", rb_get_cp_bias_coef, 0);
  rb_define_module_function(m_Chipmunk, "bias_coef=", rb_set_cp_bias_coef, 1);
  rb_define_module_function(m_Chipmunk, "collision_slop", rb_get_cp_collision_slop, 0);
  rb_define_module_function(m_Chipmunk, "collision_slop=", rb_set_cp_collision_slop, 1);
  rb_define_module_function(m_Chipmunk, "contact_persistence", rb_get_cp_contact_persistence, 0);
  rb_define_module_function(m_Chipmunk, "contact_persistence=", rb_set_cp_contact_persistence, 1);



  rb_define_module_function(m_Chipmunk, "clamp", rb_cpfclamp, 3);
  rb_define_module_function(m_Chipmunk, "flerp", rb_cpflerp, 3);
  rb_define_module_function(m_Chipmunk, "flerpconst", rb_cpflerpconst, 3);

  rb_define_module_function(m_Chipmunk, "moment_for_circle", rb_cpMomentForCircle, 4);
  rb_define_module_function(m_Chipmunk, "moment_for_poly", rb_cpMomentForPoly, 3);
  rb_define_module_function(m_Chipmunk, "moment_for_segment", rb_cpMomentForSegment, 3);
  rb_define_module_function(m_Chipmunk, "moment_for_box", rb_cpMomentForBox, 3);

  rb_define_module_function(m_Chipmunk, "circle_moment", rb_cpMomentForCircle, 4);
  rb_define_module_function(m_Chipmunk, "poly_moment", rb_cpMomentForPoly, 3);
  rb_define_module_function(m_Chipmunk, "segment_moment", rb_cpMomentForSegment, 3);
  rb_define_module_function(m_Chipmunk, "box_moment", rb_cpMomentForBox, 3);


  rb_define_module_function(m_Chipmunk, "area_for_circle", rb_cpAreaForCircle, 2);
  rb_define_module_function(m_Chipmunk, "area_for_poly", rb_cpAreaForPoly, 1);
  rb_define_module_function(m_Chipmunk, "centroid_for_poly",
                            rb_cpCentroidForPoly, 1);
  rb_define_module_function(m_Chipmunk, "recenter_poly",
                            rb_cpRecenterPoly, 1);

  rb_define_module_function(m_Chipmunk, "area_for_segment", rb_cpAreaForSegment, 3);
  rb_define_module_function(m_Chipmunk, "area_for_box", rb_cpAreaForBox, 2);

  rb_define_module_function(m_Chipmunk, "circle_area", rb_cpAreaForCircle, 2);
  rb_define_module_function(m_Chipmunk, "poly_area", rb_cpAreaForPoly, 1);
  rb_define_module_function(m_Chipmunk, "segment_area", rb_cpAreaForSegment, 3);
  rb_define_module_function(m_Chipmunk, "box_area", rb_cpAreaForBox, 2);

  rb_define_const(m_Chipmunk, "ALL_LAYERS", UINT2NUM((unsigned int)CP_ALL_LAYERS));
  rb_define_const(m_Chipmunk, "NO_GROUP", UINT2NUM(CP_NO_GROUP));

  rb_eval_string("Float::INFINITY = 1.0/0.0 unless Float.const_defined? :INFINITY");
  rb_eval_string("CP::INFINITY = 1.0/0.0 unless CP.const_defined? :INFINITY");

  Init_cpVect();
  Init_cpBB();
  Init_cpBody();
  Init_cpShape();
  Init_cpConstraint();
  Init_cpSpace();
  Init_cpArbiter();
}