/* * Chipmunk2d::SlideJoint#initialize(a, b, anchor_a, anchor_b, min, max) * @param [Chipmunk2d::Body] a * @param [Chipmunk2d::Body] b * @param [Chipmunk2d::Vect] anchor_a * @param [Chipmunk2d::Vect] anchor_b * @param [Float] min * @param [Float] max */ static mrb_value slide_joint_initialize(mrb_state* mrb, mrb_value self) { cpConstraint* constraint; cpBody* a; cpBody* b; cpVect* anchor_a; cpVect* anchor_b; mrb_value a_obj; mrb_value b_obj; mrb_float min; mrb_float max; mrb_get_args(mrb, "ooddff", &a_obj, &b_obj, &anchor_a, &mrb_cp_vect_type, &anchor_b, &mrb_cp_vect_type, &min, &max); a = mrb_cp_get_body_ptr(mrb, a_obj); b = mrb_cp_get_body_ptr(mrb, b_obj); mrb_cp_constraint_cleanup(mrb, self); constraint = cpSlideJointNew(a, b, *anchor_a, *anchor_b, (cpFloat)min, (cpFloat)max); mrb_cp_constraint_init_bind(mrb, self, constraint); mrb_iv_set(mrb, self, mrb_intern_lit(mrb, "body_a"), a_obj); mrb_iv_set(mrb, self, mrb_intern_lit(mrb, "body_b"), b_obj); return self; }
/* * @param [Chipmunk2d::Body] a * @param [Chipmunk2d::Body] b * @param [Float] phase * @param [Float] ratchet */ static mrb_value ratchet_joint_initialize(mrb_state *mrb, mrb_value self) { cpConstraint *constraint; cpBody *a; cpBody *b; mrb_value a_obj; mrb_value b_obj; mrb_float phase; mrb_float ratchet; mrb_get_args(mrb, "ooff", &a_obj, &b_obj, &phase, &ratchet); a = mrb_data_get_ptr(mrb, a_obj, &mrb_cp_body_type); b = mrb_data_get_ptr(mrb, b_obj, &mrb_cp_body_type); mrb_cp_constraint_cleanup(mrb, self); constraint = cpRatchetJointNew(a, b, (cpFloat)phase, (cpFloat)ratchet); mrb_cp_constraint_init_bind(mrb, self, constraint); mrb_iv_set(mrb, self, mrb_intern_lit(mrb, "body_a"), a_obj); mrb_iv_set(mrb, self, mrb_intern_lit(mrb, "body_b"), b_obj); return self; }