#include "reflex/ruby/event.h" #include "rays/ruby/point.h" #include "rays/ruby/bounds.h" #include "defs.h" RUCY_DEFINE_VALUE_FROM_TO(Reflex::FrameEvent) #define THIS to(self) #define CHECK RUCY_CHECK_OBJ(Reflex::FrameEvent, self) static VALUE alloc(VALUE klass) { return new_type(klass); } static VALUE initialize(VALUE self, VALUE frame, VALUE dx, VALUE dy, VALUE dwidth, VALUE dheight, VALUE zoom, VALUE dzoom, VALUE angle, VALUE dangle) { CHECK; *THIS = Reflex::FrameEvent( to(frame), to(dx), to(dy), to(dwidth), to(dheight), to(zoom), to(dzoom), to(angle), to(dangle)); return rb_call_super(0, NULL); } static VALUE initialize_copy(VALUE self, VALUE obj) { CHECK; *THIS = to(obj).dup(); return self; } static VALUE frame(VALUE self) { CHECK; return value(THIS->frame()); } static VALUE dx(VALUE self) { CHECK; return value(THIS->dx()); } static VALUE dy(VALUE self) { CHECK; return value(THIS->dy()); } static VALUE dwidth(VALUE self) { CHECK; return value(THIS->dwidth()); } static VALUE dheight(VALUE self) { CHECK; return value(THIS->dheight()); } static VALUE dposition(VALUE self) { CHECK; return value(Rays::Point(THIS->dx(), THIS->dy())); } static VALUE dsize(VALUE self) { CHECK; return value(Rays::Point(THIS->dwidth(), THIS->dheight())); } static VALUE zoom(VALUE self) { CHECK; return value(THIS->zoom()); } static VALUE dzoom(VALUE self) { CHECK; return value(THIS->dzoom()); } static VALUE angle(VALUE self) { CHECK; return value(THIS->angle()); } static VALUE dangle(VALUE self) { CHECK; return value(THIS->dangle()); } static VALUE is_move(VALUE self) { CHECK; return value(THIS->is_move()); } static VALUE is_resize(VALUE self) { CHECK; return value(THIS->is_resize()); } static VALUE is_zoom(VALUE self) { CHECK; return value(THIS->is_zoom()); } static VALUE is_rotate(VALUE self) { CHECK; return value(THIS->is_rotate()); } static Class cFrameEvent; void Init_reflex_frame_event () { Module mReflex = rb_define_module("Reflex"); cFrameEvent = mReflex.define_class("FrameEvent", Reflex::event_class()); rb_define_alloc_func(cFrameEvent, alloc); rb_define_private_method(cFrameEvent, "initialize", RUBY_METHOD_FUNC(initialize), 9); rb_define_private_method(cFrameEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1); rb_define_method(cFrameEvent, "frame", RUBY_METHOD_FUNC(frame), 0); rb_define_method(cFrameEvent, "dx", RUBY_METHOD_FUNC(dx), 0); rb_define_method(cFrameEvent, "dy", RUBY_METHOD_FUNC(dy), 0); rb_define_method(cFrameEvent, "dwidth", RUBY_METHOD_FUNC(dwidth), 0); rb_define_method(cFrameEvent, "dheight", RUBY_METHOD_FUNC(dheight), 0); rb_define_method(cFrameEvent, "dposition", RUBY_METHOD_FUNC(dposition), 0); rb_define_method(cFrameEvent, "dsize", RUBY_METHOD_FUNC(dsize), 0); rb_define_method(cFrameEvent, "zoom", RUBY_METHOD_FUNC(zoom), 0); rb_define_method(cFrameEvent, "dzoom", RUBY_METHOD_FUNC(dzoom), 0); rb_define_method(cFrameEvent, "angle", RUBY_METHOD_FUNC(angle), 0); rb_define_method(cFrameEvent, "dangle", RUBY_METHOD_FUNC(dangle), 0); cFrameEvent.define_method("move?", is_move); cFrameEvent.define_method("resize?", is_resize); cFrameEvent.define_method("zoom?", is_zoom); cFrameEvent.define_method("rotate?", is_rotate); } namespace Reflex { Class frame_event_class () { return cFrameEvent; } }// Reflex