Sha256: 4277465b509568093ad57cb04957a4816d60c62ad6e20556a71966e59f8ddfed
Contents?: true
Size: 1.7 KB
Versions: 6
Compression:
Stored size: 1.7 KB
Contents
#include "reflex/ruby/event.h" #include <rucy.h> #include <rays/ruby/painter.h> #include <rays/ruby/bounds.h> #include "defs.h" using namespace Rucy; RUCY_DEFINE_VALUE_FROM_TO(Reflex::DrawEvent) #define THIS to<Reflex::DrawEvent*>(self) #define CHECK RUCY_CHECK_OBJ(Reflex::DrawEvent, self) static VALUE alloc(VALUE klass) { return new_type<Reflex::DrawEvent>(klass); } static VALUE initialize(VALUE self) { CHECK; check_arg_count(__FILE__, __LINE__, "DrawEvent#initialize", argc, 0, 1); THIS->dt = (argc >= 1) ? argv[0].as_f() : 0; return rb_call_super(0, NULL); } static VALUE initialize_copy(VALUE self, VALUE obj) { CHECK; *THIS = to<Reflex::DrawEvent&>(obj); return self; } static VALUE painter(VALUE self) { CHECK; return value(THIS->painter); } static VALUE bounds(VALUE self) { CHECK; return value(THIS->bounds); } static VALUE dt(VALUE self) { CHECK; return value(THIS->dt); } static VALUE fps(VALUE self) { CHECK; return value(THIS->fps); } static Class cDrawEvent; void Init_draw_event () { Module mReflex = rb_define_module("Reflex"); cDrawEvent = mReflex.define_class("DrawEvent", Reflex::event_class()); rb_define_alloc_func(cDrawEvent, alloc); rb_define_private_method(cDrawEvent, "initialize", RUBY_METHOD_FUNC(initialize), -1); rb_define_private_method(cDrawEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1); rb_define_method(cDrawEvent, "painter", RUBY_METHOD_FUNC(painter), 0); rb_define_method(cDrawEvent, "bounds", RUBY_METHOD_FUNC(bounds), 0); rb_define_method(cDrawEvent, "dt", RUBY_METHOD_FUNC(dt), 0); rb_define_method(cDrawEvent, "fps", RUBY_METHOD_FUNC(fps), 0); } namespace Reflex { Class draw_event_class () { return cDrawEvent; } }// Reflex
Version data entries
6 entries across 6 versions & 1 rubygems