.doc/ext/reflex/update_event.cpp in reflexion-0.1.12 vs .doc/ext/reflex/update_event.cpp in reflexion-0.1.13
- old
+ new
@@ -1,15 +1,11 @@
#include "reflex/ruby/event.h"
-#include <rucy.h>
#include "defs.h"
-using namespace Rucy;
-
-
RUCY_DEFINE_VALUE_FROM_TO(Reflex::UpdateEvent)
#define THIS to<Reflex::UpdateEvent*>(self)
#define CHECK RUCY_CHECK_OBJ(Reflex::UpdateEvent, self)
@@ -23,13 +19,14 @@
static
VALUE initialize(VALUE self)
{
CHECK;
- check_arg_count(__FILE__, __LINE__, "UpdateEvent#initialize", argc, 0, 1);
+ check_arg_count(__FILE__, __LINE__, "UpdateEvent#initialize", argc, 0, 1, 2);
- THIS->dt = (argc >= 1) ? argv[0].as_f() : 0;
+ THIS->now = (argc >= 1) ? to<double>(argv[0]) : 0;
+ THIS->dt = (argc >= 2) ? to<float>(argv[1]) : 0;
return rb_call_super(0, NULL);
}
static
@@ -39,10 +36,17 @@
*THIS = to<Reflex::UpdateEvent&>(obj);
return self;
}
static
+VALUE now(VALUE self)
+{
+ CHECK;
+ return value(THIS->now);
+}
+
+static
VALUE dt(VALUE self)
{
CHECK;
return value(THIS->dt);
}
@@ -57,9 +61,10 @@
cUpdateEvent = mReflex.define_class("UpdateEvent", Reflex::event_class());
rb_define_alloc_func(cUpdateEvent, alloc);
rb_define_private_method(cUpdateEvent, "initialize", RUBY_METHOD_FUNC(initialize), -1);
rb_define_private_method(cUpdateEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
+ rb_define_method(cUpdateEvent, "now", RUBY_METHOD_FUNC(now), 0);
rb_define_method(cUpdateEvent, "dt", RUBY_METHOD_FUNC(dt), 0);
}
namespace Reflex