Sha256: 7f638b3ef42e72af3619facc396493837bd4a4c69e63623dfe7e4802c5fed4a4
Contents?: true
Size: 1.88 KB
Versions: 6
Compression:
Stored size: 1.88 KB
Contents
#include "reflex/ruby/event.h" #include "reflex/ruby/shape.h" #include "reflex/ruby/view.h" #include "reflex/ruby/shape.h" #include "defs.h" RUCY_DEFINE_VALUE_FROM_TO(Reflex::ContactEvent) #define THIS to<Reflex::ContactEvent*>(self) #define CHECK RUCY_CHECK_OBJ(Reflex::ContactEvent, self) static VALUE alloc(VALUE klass) { return new_type<Reflex::ContactEvent>(klass); } static VALUE initialize(VALUE self, VALUE action, VALUE shape) { CHECK; *THIS = Reflex::ContactEvent( (Reflex::ContactEvent::Action) to<uint>(action), to<Reflex::Shape*>(shape)); return rb_call_super(0, NULL); } static VALUE initialize_copy(VALUE self, VALUE obj) { CHECK; *THIS = to<Reflex::ContactEvent&>(obj).dup(); return self; } static VALUE get_action(VALUE self) { CHECK; return value(THIS->action()); } static VALUE get_shape(VALUE self) { CHECK; return value(THIS->shape()); } static VALUE get_view(VALUE self) { CHECK; return value(THIS->view()); } static Class cContactEvent; void Init_contact_event () { Module mReflex = rb_define_module("Reflex"); cContactEvent = mReflex.define_class("ContactEvent", Reflex::event_class()); rb_define_alloc_func(cContactEvent, alloc); rb_define_private_method(cContactEvent, "initialize", RUBY_METHOD_FUNC(initialize), 2); rb_define_private_method(cContactEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1); rb_define_method(cContactEvent, "action", RUBY_METHOD_FUNC(get_action), 0); rb_define_method(cContactEvent, "shape", RUBY_METHOD_FUNC(get_shape), 0); rb_define_method(cContactEvent, "view", RUBY_METHOD_FUNC(get_view), 0); cContactEvent.define_const("ACTION_NONE", Reflex::ContactEvent::ACTION_NONE); cContactEvent.define_const("BEGIN", Reflex::ContactEvent::BEGIN); cContactEvent.define_const("END", Reflex::ContactEvent::END); } namespace Reflex { Class contact_event_class () { return cContactEvent; } }// Reflex
Version data entries
6 entries across 6 versions & 1 rubygems