void InitUnder(VALUE parent) { VALUE cTaskbarProcess = Qnil; if (parent == Qnil) { cTaskbarProcess = rb_define_class("TaskbarProgress", rb_cObject); } else { cTaskbarProcess = rb_define_class_under(parent, "TaskbarProgress", rb_cObject); } rb_define_const(cTaskbarProcess, "CEXT_VERSION", GetRubyInterface("1.0.0")); rb_define_alloc_func(cTaskbarProcess, wrap_progressbar_alloc); rb_define_method(cTaskbarProcess, "set_state", VALUEFUNC(wrap_set_state), 1); rb_define_method(cTaskbarProcess, "set_value", VALUEFUNC(wrap_set_value), 2); rb_define_const(cTaskbarProcess, "NOPROGRESS", INT2NUM(TBPF_NOPROGRESS)); rb_define_const(cTaskbarProcess, "INDETERMINATE", INT2NUM(TBPF_INDETERMINATE)); rb_define_const(cTaskbarProcess, "NORMAL", INT2NUM(TBPF_NORMAL)); rb_define_const(cTaskbarProcess, "ERROR", INT2NUM(TBPF_ERROR)); rb_define_const(cTaskbarProcess, "PAUSED", INT2NUM(TBPF_PAUSED)); }
void Init_msp_bodies(VALUE mNewton) { VALUE mBodies = rb_define_module_under(mNewton, "Bodies"); rb_define_module_function(mBodies, "aabb_overlap?", VALUEFUNC(MSNewton::Bodies::aabb_overlap), 2); rb_define_module_function(mBodies, "collidable?", VALUEFUNC(MSNewton::Bodies::collidable), 2); rb_define_module_function(mBodies, "touching?", VALUEFUNC(MSNewton::Bodies::touching), 2); rb_define_module_function(mBodies, "get_closest_points", VALUEFUNC(MSNewton::Bodies::get_closest_points), 2); rb_define_module_function(mBodies, "get_force_in_between", VALUEFUNC(MSNewton::Bodies::get_force_in_between), 2); }
void Init_SUEX_HelloWorld() { VALUE mSUEX_HelloWorld = rb_define_module("SUEX_HelloWorld"); rb_define_const(mSUEX_HelloWorld, "CEXT_VERSION", GetRubyInterface("1.0.0")); rb_define_module_function(mSUEX_HelloWorld, "hello_world", VALUEFUNC(hello_world), 0); }
void Init_msp_newton(VALUE mNewton) { rb_define_module_function(mNewton, "get_version", VALUEFUNC(MSPhysics::Newton::get_version), 0); rb_define_module_function(mNewton, "get_float_size", VALUEFUNC(MSPhysics::Newton::get_float_size), 0); rb_define_module_function(mNewton, "get_memory_used", VALUEFUNC(MSPhysics::Newton::get_memory_used), 0); rb_define_module_function(mNewton, "get_all_worlds", VALUEFUNC(MSPhysics::Newton::get_all_worlds), 0); rb_define_module_function(mNewton, "get_all_bodies", VALUEFUNC(MSPhysics::Newton::get_all_bodies), 0); rb_define_module_function(mNewton, "get_all_joints", VALUEFUNC(MSPhysics::Newton::get_all_joints), 0); rb_define_module_function(mNewton, "enable_object_validation", VALUEFUNC(MSPhysics::Newton::enable_object_validation), 1); rb_define_module_function(mNewton, "is_object_validation_enabled?", VALUEFUNC(MSPhysics::Newton::is_object_validation_enabled), 0); }
VALUE RubyEvaluator::GetContext(KObjectRef global) { std::string theid = this->GetContextId(global); VALUE ctx = rb_gv_get(theid.c_str()); if (ctx == Qnil) { VALUE ctx_class = rb_define_class("KrollRubyContext", rb_cObject); rb_define_method(ctx_class, "method_missing", VALUEFUNC(m_missing), -1); ctx = rb_obj_alloc(ctx_class); rb_gv_set(theid.c_str(), ctx); } return ctx; }
void Init_msp_lib() { VALUE mMSPhysics = rb_define_module("MSPhysics"); VALUE mNewton = rb_define_module_under(mMSPhysics, "Newton"); VALUE mC = rb_define_module_under(mMSPhysics, "C"); Init_msp_util(mMSPhysics); Init_msp_newton(mNewton); Init_msp_world(mNewton); Init_msp_collision(mNewton); Init_msp_body(mNewton); Init_msp_bodies(mNewton); Init_msp_joint(mNewton); Init_msp_ball_and_socket(mNewton); Init_msp_corkscrew(mNewton); Init_msp_fixed(mNewton); Init_msp_hinge(mNewton); Init_msp_motor(mNewton); Init_msp_servo(mNewton); Init_msp_slider(mNewton); Init_msp_piston(mNewton); Init_msp_spring(mNewton); Init_msp_up_vector(mNewton); Init_msp_universal(mNewton); Init_msp_curvy_slider(mNewton); Init_msp_curvy_piston(mNewton); Init_msp_plane(mNewton); #ifdef USE_SDL Init_msp_sdl(mMSPhysics); Init_msp_sdl_mixer(mMSPhysics); Init_msp_sound(mMSPhysics); Init_msp_music(mMSPhysics); Init_msp_joystick(mMSPhysics); #endif Init_msp_particle(mC); rb_define_module_function(mMSPhysics, "sdl_used?", VALUEFUNC(msp_sdl_used), 0); }
void Init_msp_music(VALUE mMSPhysics) { VALUE mMusic = rb_define_module_under(mMSPhysics, "Music"); rb_define_module_function(mMusic, "is_valid?", VALUEFUNC(MSPhysics::Music::is_valid), 1); rb_define_module_function(mMusic, "create_from_dir", VALUEFUNC(MSPhysics::Music::create_from_dir), 1); rb_define_module_function(mMusic, "create_from_buffer", VALUEFUNC(MSPhysics::Music::create_from_buffer), 2); rb_define_module_function(mMusic, "destroy", VALUEFUNC(MSPhysics::Music::destroy), 1); rb_define_module_function(mMusic, "destroy_all", VALUEFUNC(MSPhysics::Music::destroy_all), 0); rb_define_module_function(mMusic, "get_name", VALUEFUNC(MSPhysics::Music::get_name), 1); rb_define_module_function(mMusic, "set_name", VALUEFUNC(MSPhysics::Music::set_name), 2); rb_define_module_function(mMusic, "get_by_name", VALUEFUNC(MSPhysics::Music::get_by_name), 1); rb_define_module_function(mMusic, "get_all_music", VALUEFUNC(MSPhysics::Music::get_all_music), 0); rb_define_module_function(mMusic, "play", VALUEFUNC(MSPhysics::Music::play), 2); rb_define_module_function(mMusic, "pause", VALUEFUNC(MSPhysics::Music::pause), 0); rb_define_module_function(mMusic, "resume", VALUEFUNC(MSPhysics::Music::resume), 0); rb_define_module_function(mMusic, "stop", VALUEFUNC(MSPhysics::Music::stop), 0); rb_define_module_function(mMusic, "fade_in", VALUEFUNC(MSPhysics::Music::fade_in), 3); rb_define_module_function(mMusic, "fade_out", VALUEFUNC(MSPhysics::Music::fade_out), 1); rb_define_module_function(mMusic, "get_volume", VALUEFUNC(MSPhysics::Music::get_volume), 0); rb_define_module_function(mMusic, "set_volume", VALUEFUNC(MSPhysics::Music::set_volume), 1); rb_define_module_function(mMusic, "is_playing?", VALUEFUNC(MSPhysics::Music::is_playing), 0); rb_define_module_function(mMusic, "is_paused?", VALUEFUNC(MSPhysics::Music::is_paused), 0); rb_define_module_function(mMusic, "is_stopped?", VALUEFUNC(MSPhysics::Music::is_stopped), 0); rb_define_module_function(mMusic, "is_fading?", VALUEFUNC(MSPhysics::Music::is_fading), 0); rb_define_module_function(mMusic, "get_type", VALUEFUNC(MSPhysics::Music::get_type), 1); }
void MSP::BallAndSocket::init_ruby(VALUE mNewton) { VALUE mBallAndSocket = rb_define_module_under(mNewton, "BallAndSocket"); rb_define_module_function(mBallAndSocket, "is_valid?", VALUEFUNC(MSP::BallAndSocket::rbf_is_valid), 1); rb_define_module_function(mBallAndSocket, "create", VALUEFUNC(MSP::BallAndSocket::rbf_create), 1); rb_define_module_function(mBallAndSocket, "get_max_cone_angle", VALUEFUNC(MSP::BallAndSocket::rbf_get_max_cone_angle), 1); rb_define_module_function(mBallAndSocket, "set_max_cone_angle", VALUEFUNC(MSP::BallAndSocket::rbf_set_max_cone_angle), 2); rb_define_module_function(mBallAndSocket, "enable_cone_limits", VALUEFUNC(MSP::BallAndSocket::rbf_enable_cone_limits), 2); rb_define_module_function(mBallAndSocket, "cone_limits_enabled?", VALUEFUNC(MSP::BallAndSocket::rbf_cone_limits_enabled), 1); rb_define_module_function(mBallAndSocket, "get_min_twist_angle", VALUEFUNC(MSP::BallAndSocket::rbf_get_min_twist_angle), 1); rb_define_module_function(mBallAndSocket, "set_min_twist_angle", VALUEFUNC(MSP::BallAndSocket::rbf_set_min_twist_angle), 2); rb_define_module_function(mBallAndSocket, "get_max_twist_angle", VALUEFUNC(MSP::BallAndSocket::rbf_get_max_twist_angle), 1); rb_define_module_function(mBallAndSocket, "set_max_twist_angle", VALUEFUNC(MSP::BallAndSocket::rbf_set_max_twist_angle), 2); rb_define_module_function(mBallAndSocket, "enable_twist_limits", VALUEFUNC(MSP::BallAndSocket::rbf_enable_twist_limits), 2); rb_define_module_function(mBallAndSocket, "twist_limits_enabled?", VALUEFUNC(MSP::BallAndSocket::rbf_twist_limits_enabled), 1); rb_define_module_function(mBallAndSocket, "get_cur_cone_angle", VALUEFUNC(MSP::BallAndSocket::rbf_get_cur_cone_angle), 1); rb_define_module_function(mBallAndSocket, "get_cur_twist_angle", VALUEFUNC(MSP::BallAndSocket::rbf_get_cur_twist_angle), 1); rb_define_module_function(mBallAndSocket, "get_cur_twist_omega", VALUEFUNC(MSP::BallAndSocket::rbf_get_cur_twist_omega), 1); rb_define_module_function(mBallAndSocket, "get_cur_twist_alpha", VALUEFUNC(MSP::BallAndSocket::rbf_get_cur_twist_alpha), 1); rb_define_module_function(mBallAndSocket, "get_friction", VALUEFUNC(MSP::BallAndSocket::rbf_get_friction), 1); rb_define_module_function(mBallAndSocket, "set_friction", VALUEFUNC(MSP::BallAndSocket::rbf_set_friction), 2); rb_define_module_function(mBallAndSocket, "get_controller", VALUEFUNC(MSP::BallAndSocket::rbf_get_controller), 1); rb_define_module_function(mBallAndSocket, "set_controller", VALUEFUNC(MSP::BallAndSocket::rbf_set_controller), 2); }
void Init_msp_fixed(VALUE mNewton) { VALUE mFixed = rb_define_module_under(mNewton, "Fixed"); rb_define_module_function(mFixed, "is_valid?", VALUEFUNC(MSNewton::Fixed::is_valid), 1); rb_define_module_function(mFixed, "create", VALUEFUNC(MSNewton::Fixed::create), 1); }
void Init_msp_slider(VALUE mNewton) { VALUE mSlider = rb_define_module_under(mNewton, "Slider"); rb_define_module_function(mSlider, "is_valid?", VALUEFUNC(MSNewton::Slider::is_valid), 1); rb_define_module_function(mSlider, "create", VALUEFUNC(MSNewton::Slider::create), 1); rb_define_module_function(mSlider, "get_cur_position", VALUEFUNC(MSNewton::Slider::get_cur_position), 1); rb_define_module_function(mSlider, "get_cur_velocity", VALUEFUNC(MSNewton::Slider::get_cur_velocity), 1); rb_define_module_function(mSlider, "get_cur_acceleration", VALUEFUNC(MSNewton::Slider::get_cur_acceleration), 1); rb_define_module_function(mSlider, "get_min", VALUEFUNC(MSNewton::Slider::get_min), 1); rb_define_module_function(mSlider, "set_min", VALUEFUNC(MSNewton::Slider::set_min), 2); rb_define_module_function(mSlider, "get_max", VALUEFUNC(MSNewton::Slider::get_max), 1); rb_define_module_function(mSlider, "set_max", VALUEFUNC(MSNewton::Slider::set_max), 2); rb_define_module_function(mSlider, "enable_limits", VALUEFUNC(MSNewton::Slider::enable_limits), 2); rb_define_module_function(mSlider, "limits_enabled?", VALUEFUNC(MSNewton::Slider::limits_enabled), 1); rb_define_module_function(mSlider, "get_friction", VALUEFUNC(MSNewton::Slider::get_friction), 1); rb_define_module_function(mSlider, "set_friction", VALUEFUNC(MSNewton::Slider::set_friction), 2); rb_define_module_function(mSlider, "get_controller", VALUEFUNC(MSNewton::Slider::get_controller), 1); rb_define_module_function(mSlider, "set_controller", VALUEFUNC(MSNewton::Slider::set_controller), 2); }
SWIGEXPORT(void) Init_GameServers(void) { int i; SWIG_InitRuntime(); mGameServers = rb_define_module("GameServers"); for (i = 0; swig_types_initial[i]; i++) { swig_types[i] = SWIG_TypeRegister(swig_types_initial[i]); SWIG_define_class(swig_types[i]); } cHLServerInfos.klass = rb_define_class_under(mGameServers, "HLServerInfos", rb_cObject); SWIG_TypeClientData(SWIGTYPE_p_server_info, (void *) &cHLServerInfos); rb_define_alloc_func(cHLServerInfos.klass, _wrap_HLServerInfos_allocate); rb_define_method(cHLServerInfos.klass, "initialize", VALUEFUNC(_wrap_new_HLServerInfos), -1); rb_define_method(cHLServerInfos.klass, "address", VALUEFUNC(_wrap_HLServerInfos_address_get), -1); rb_define_method(cHLServerInfos.klass, "hostname", VALUEFUNC(_wrap_HLServerInfos_hostname_get), -1); rb_define_method(cHLServerInfos.klass, "curmap", VALUEFUNC(_wrap_HLServerInfos_curmap_get), -1); rb_define_method(cHLServerInfos.klass, "gamedir", VALUEFUNC(_wrap_HLServerInfos_gamedir_get), -1); rb_define_method(cHLServerInfos.klass, "gamedesc", VALUEFUNC(_wrap_HLServerInfos_gamedesc_get), -1); rb_define_method(cHLServerInfos.klass, "country", VALUEFUNC(_wrap_HLServerInfos_country_get), -1); rb_define_method(cHLServerInfos.klass, "cur_clients", VALUEFUNC(_wrap_HLServerInfos_cur_clients_get), -1); rb_define_method(cHLServerInfos.klass, "max_clients", VALUEFUNC(_wrap_HLServerInfos_max_clients_get), -1); cHLServerInfos.mark = 0; cHLServerInfos.destroy = (void (*)(void *)) free_server_info; cHLServer.klass = rb_define_class_under(mGameServers, "HLServer", rb_cObject); SWIG_TypeClientData(SWIGTYPE_p_HLServer, (void *) &cHLServer); rb_define_alloc_func(cHLServer.klass, _wrap_HLServer_allocate); rb_define_method(cHLServer.klass, "initialize", VALUEFUNC(_wrap_new_HLServer), -1); rb_define_method(cHLServer.klass, "ping", VALUEFUNC(_wrap_HLServer_ping), -1); rb_define_method(cHLServer.klass, "get_infos", VALUEFUNC(_wrap_HLServer_get_infos), -1); cHLServer.mark = 0; cHLServer.destroy = (void (*)(void *)) free_HLServer; }
void MSP::PointToPoint::init_ruby(VALUE mNewton) { VALUE mPointToPoint = rb_define_module_under(mNewton, "PointToPoint"); rb_define_module_function(mPointToPoint, "is_valid?", VALUEFUNC(MSP::PointToPoint::rbf_is_valid), 1); rb_define_module_function(mPointToPoint, "create", VALUEFUNC(MSP::PointToPoint::rbf_create), 1); rb_define_module_function(mPointToPoint, "get_accel", VALUEFUNC(MSP::PointToPoint::rbf_get_accel), 1); rb_define_module_function(mPointToPoint, "set_accel", VALUEFUNC(MSP::PointToPoint::rbf_set_accel), 2); rb_define_module_function(mPointToPoint, "get_damp", VALUEFUNC(MSP::PointToPoint::rbf_get_damp), 1); rb_define_module_function(mPointToPoint, "set_damp", VALUEFUNC(MSP::PointToPoint::rbf_set_damp), 2); rb_define_module_function(mPointToPoint, "get_strength", VALUEFUNC(MSP::PointToPoint::rbf_get_strength), 1); rb_define_module_function(mPointToPoint, "set_strength", VALUEFUNC(MSP::PointToPoint::rbf_set_strength), 2); rb_define_module_function(mPointToPoint, "get_mode", VALUEFUNC(MSP::PointToPoint::rbf_get_mode), 1); rb_define_module_function(mPointToPoint, "set_mode", VALUEFUNC(MSP::PointToPoint::rbf_set_mode), 2); rb_define_module_function(mPointToPoint, "get_start_distance", VALUEFUNC(MSP::PointToPoint::rbf_get_start_distance), 1); rb_define_module_function(mPointToPoint, "set_start_distance", VALUEFUNC(MSP::PointToPoint::rbf_set_start_distance), 2); rb_define_module_function(mPointToPoint, "get_controller", VALUEFUNC(MSP::PointToPoint::rbf_get_controller), 1); rb_define_module_function(mPointToPoint, "set_controller", VALUEFUNC(MSP::PointToPoint::rbf_set_controller), 2); rb_define_module_function(mPointToPoint, "get_cur_distance", VALUEFUNC(MSP::PointToPoint::rbf_get_cur_distance), 1); }
void Init_msp_servo(VALUE mNewton) { VALUE mServo = rb_define_module_under(mNewton, "Servo"); rb_define_module_function(mServo, "is_valid?", VALUEFUNC(MSNewton::Servo::is_valid), 1); rb_define_module_function(mServo, "create", VALUEFUNC(MSNewton::Servo::create), 1); rb_define_module_function(mServo, "get_cur_angle", VALUEFUNC(MSNewton::Servo::get_cur_angle), 1); rb_define_module_function(mServo, "get_cur_omega", VALUEFUNC(MSNewton::Servo::get_cur_omega), 1); rb_define_module_function(mServo, "get_cur_acceleration", VALUEFUNC(MSNewton::Servo::get_cur_acceleration), 1); rb_define_module_function(mServo, "get_min", VALUEFUNC(MSNewton::Servo::get_min), 1); rb_define_module_function(mServo, "set_min", VALUEFUNC(MSNewton::Servo::set_min), 2); rb_define_module_function(mServo, "get_max", VALUEFUNC(MSNewton::Servo::get_max), 1); rb_define_module_function(mServo, "set_max", VALUEFUNC(MSNewton::Servo::set_max), 2); rb_define_module_function(mServo, "enable_limits", VALUEFUNC(MSNewton::Servo::enable_limits), 2); rb_define_module_function(mServo, "limits_enabled?", VALUEFUNC(MSNewton::Servo::limits_enabled), 1); rb_define_module_function(mServo, "get_rate", VALUEFUNC(MSNewton::Servo::get_rate), 1); rb_define_module_function(mServo, "set_rate", VALUEFUNC(MSNewton::Servo::set_rate), 2); rb_define_module_function(mServo, "get_power", VALUEFUNC(MSNewton::Servo::get_power), 1); rb_define_module_function(mServo, "set_power", VALUEFUNC(MSNewton::Servo::set_power), 2); rb_define_module_function(mServo, "get_reduction_ratio", VALUEFUNC(MSNewton::Servo::get_reduction_ratio), 1); rb_define_module_function(mServo, "set_reduction_ratio", VALUEFUNC(MSNewton::Servo::set_reduction_ratio), 2); rb_define_module_function(mServo, "get_controller", VALUEFUNC(MSNewton::Servo::get_controller), 1); rb_define_module_function(mServo, "set_controller", VALUEFUNC(MSNewton::Servo::set_controller), 2); }
void Init_msp_curvy_slider(VALUE mNewton) { VALUE mCurvySlider = rb_define_module_under(mNewton, "CurvySlider"); rb_define_module_function(mCurvySlider, "is_valid?", VALUEFUNC(MSNewton::CurvySlider::is_valid), 1); rb_define_module_function(mCurvySlider, "create", VALUEFUNC(MSNewton::CurvySlider::create), 1); rb_define_module_function(mCurvySlider, "add_point", VALUEFUNC(MSNewton::CurvySlider::add_point), 2); rb_define_module_function(mCurvySlider, "remove_point", VALUEFUNC(MSNewton::CurvySlider::remove_point), 2); rb_define_module_function(mCurvySlider, "get_points", VALUEFUNC(MSNewton::CurvySlider::get_points), 1); rb_define_module_function(mCurvySlider, "get_points_size", VALUEFUNC(MSNewton::CurvySlider::get_points), 1); rb_define_module_function(mCurvySlider, "clear_points", VALUEFUNC(MSNewton::CurvySlider::clear_points), 2); rb_define_module_function(mCurvySlider, "get_point_position", VALUEFUNC(MSNewton::CurvySlider::get_point_position), 2); rb_define_module_function(mCurvySlider, "set_point_position", VALUEFUNC(MSNewton::CurvySlider::set_point_position), 3); rb_define_module_function(mCurvySlider, "get_length", VALUEFUNC(MSNewton::CurvySlider::get_length), 1); rb_define_module_function(mCurvySlider, "get_cur_position", VALUEFUNC(MSNewton::CurvySlider::get_cur_position), 1); rb_define_module_function(mCurvySlider, "get_cur_velocity", VALUEFUNC(MSNewton::CurvySlider::get_cur_velocity), 1); rb_define_module_function(mCurvySlider, "get_cur_acceleration", VALUEFUNC(MSNewton::CurvySlider::get_cur_acceleration), 1); rb_define_module_function(mCurvySlider, "get_cur_point", VALUEFUNC(MSNewton::CurvySlider::get_cur_point), 1); rb_define_module_function(mCurvySlider, "get_cur_vector", VALUEFUNC(MSNewton::CurvySlider::get_cur_vector), 1); rb_define_module_function(mCurvySlider, "get_cur_tangent", VALUEFUNC(MSNewton::CurvySlider::get_cur_tangent), 1); rb_define_module_function(mCurvySlider, "get_linear_friction", VALUEFUNC(MSNewton::CurvySlider::get_linear_friction), 1); rb_define_module_function(mCurvySlider, "set_linear_friction", VALUEFUNC(MSNewton::CurvySlider::set_linear_friction), 2); rb_define_module_function(mCurvySlider, "get_angular_friction", VALUEFUNC(MSNewton::CurvySlider::get_angular_friction), 1); rb_define_module_function(mCurvySlider, "set_angular_friction", VALUEFUNC(MSNewton::CurvySlider::set_angular_friction), 2); rb_define_module_function(mCurvySlider, "get_controller", VALUEFUNC(MSNewton::CurvySlider::get_controller), 1); rb_define_module_function(mCurvySlider, "set_controller", VALUEFUNC(MSNewton::CurvySlider::set_controller), 2); rb_define_module_function(mCurvySlider, "loop_enabled?", VALUEFUNC(MSNewton::CurvySlider::loop_enabled), 1); rb_define_module_function(mCurvySlider, "enable_loop", VALUEFUNC(MSNewton::CurvySlider::enable_loop), 2); rb_define_module_function(mCurvySlider, "alignment_enabled?", VALUEFUNC(MSNewton::CurvySlider::alignment_enabled), 1); rb_define_module_function(mCurvySlider, "enable_alignment", VALUEFUNC(MSNewton::CurvySlider::enable_alignment), 2); rb_define_module_function(mCurvySlider, "rotation_enabled?", VALUEFUNC(MSNewton::CurvySlider::rotation_enabled), 1); rb_define_module_function(mCurvySlider, "enable_rotation", VALUEFUNC(MSNewton::CurvySlider::enable_rotation), 2); rb_define_module_function(mCurvySlider, "get_info_by_pos", VALUEFUNC(MSNewton::CurvySlider::get_info_by_pos), 2); }