예제 #1
0
extern "C" void mrb_EasyRPG_Player_gem_init(mrb_state* M) {
	EasyRPG::register_audio(M);
	EasyRPG::register_bitmap(M);
	EasyRPG::register_cache(M);
	EasyRPG::register_color(M);
	EasyRPG::register_filefinder(M);
	EasyRPG::register_font(M);
	EasyRPG::register_graphics(M);
	EasyRPG::register_image_io(M);
	EasyRPG::register_input(M);
	EasyRPG::register_keys(M);
	EasyRPG::register_output(M);
	EasyRPG::register_plane(M);
	EasyRPG::register_rect(M);
	EasyRPG::register_sprite(M);
	EasyRPG::register_text(M);
	EasyRPG::register_tilemap(M);
	EasyRPG::register_tone(M);
	EasyRPG::register_utils(M);
	EasyRPG::register_window(M);
  EasyRPG::register_registry(M);

	mrb_define_method(M, M->array_class, "index", &array_index, MRB_ARGS_OPT(1) | MRB_ARGS_BLOCK());
	mrb_define_method(M, M->array_class, "rindex", &array_rindex, MRB_ARGS_OPT(1) | MRB_ARGS_BLOCK());
}
예제 #2
0
파일: exception.c 프로젝트: ASnow/mruby
void
mrb_mruby_error_gem_test(mrb_state *mrb)
{
  struct RClass *cls;

  cls = mrb_define_class(mrb, "ExceptionTest", mrb->object_class);
  mrb_define_module_function(mrb, cls, "mrb_protect", run_protect, MRB_ARGS_NONE() | MRB_ARGS_BLOCK());
  mrb_define_module_function(mrb, cls, "mrb_ensure", run_ensure, MRB_ARGS_REQ(2));
  mrb_define_module_function(mrb, cls, "mrb_rescue", run_rescue, MRB_ARGS_REQ(2));
  mrb_define_module_function(mrb, cls, "mrb_rescue_exceptions", run_rescue_exceptions, MRB_ARGS_REQ(2));
}
예제 #3
0
void mrb_mruby_sample_buffer_gem_init(mrb_state* mrb)
{
  struct RClass *sample_buffer_class;
  sample_buffer_class = mrb_define_class(mrb, "SampleBuffer", mrb->object_class);
  MRB_SET_INSTANCE_TT(sample_buffer_class, MRB_TT_DATA);
  mrb_include_module(mrb, sample_buffer_class, mrb_module_get(mrb, "Enumerable"));
  mrb_define_method(mrb, sample_buffer_class, "initialize", mrb_sample_buffer_initialize, MRB_ARGS_ARG(1, 1));
  mrb_define_method(mrb, sample_buffer_class, "length", mrb_sample_buffer_length_method, MRB_ARGS_NONE());
  mrb_define_method(mrb, sample_buffer_class, "size", mrb_sample_buffer_length_method, MRB_ARGS_NONE());
  mrb_define_method(mrb, sample_buffer_class, "offset", mrb_sample_buffer_offset_method, MRB_ARGS_NONE());
  mrb_define_method(mrb, sample_buffer_class, "[]", mrb_sample_buffer_get_method, MRB_ARGS_REQ(1));
  mrb_define_method(mrb, sample_buffer_class, "[]=", mrb_sample_buffer_set_method, MRB_ARGS_REQ(2));
  mrb_define_method(mrb, sample_buffer_class, "each", mrb_sample_buffer_each_method, MRB_ARGS_BLOCK());
  mrb_define_method(mrb, sample_buffer_class, "slice", mrb_sample_buffer_slice_method, MRB_ARGS_ARG(1, 1));
  mrb_define_method(mrb, sample_buffer_class, "channel", mrb_sample_buffer_channel_get_method, MRB_ARGS_REQ(0));
  mrb_define_method(mrb, sample_buffer_class, "channel=", mrb_sample_buffer_channel_set_method, MRB_ARGS_REQ(1));
}
예제 #4
0
파일: object.c 프로젝트: CaptainJet/mruby
void
mrb_mruby_object_ext_gem_init(mrb_state* mrb)
{
  struct RClass * n = mrb->nil_class;

  mrb_define_method(mrb, n, "to_a", nil_to_a,       MRB_ARGS_NONE());
  mrb_define_method(mrb, n, "to_f", nil_to_f,       MRB_ARGS_NONE());
  mrb_define_method(mrb, n, "to_i", nil_to_i,       MRB_ARGS_NONE());

  mrb_define_method(mrb, mrb->object_class, "instance_exec", mrb_obj_instance_exec, MRB_ARGS_ANY() | MRB_ARGS_BLOCK());
}