Sha256: 64c41360b20ab6a3204ee308ab1603460e1cf3346fbf169e27214013933b1cbc

Contents?: true

Size: 1.26 KB

Versions: 6

Compression:

Stored size: 1.26 KB

Contents

#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)


static
VALUE alloc(VALUE klass)
{
	return new_type<Reflex::UpdateEvent>(klass);
}

static
VALUE initialize(VALUE self)
{
	CHECK;
	check_arg_count(__FILE__, __LINE__, "UpdateEvent#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::UpdateEvent&>(obj);
	return self;
}

static
VALUE dt(VALUE self)
{
	CHECK;
	return value(THIS->dt);
}


static Class cUpdateEvent;

void
Init_update_event ()
{
	Module mReflex = rb_define_module("Reflex");

	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, "dt", RUBY_METHOD_FUNC(dt), 0);
}


namespace Reflex
{


	Class
	update_event_class ()
	{
		return cUpdateEvent;
	}


}// Reflex

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
reflexion-0.1.12 .doc/ext/reflex/update_event.cpp
reflexion-0.1.11 .doc/ext/reflex/update_event.cpp
reflexion-0.1.10 .doc/ext/reflex/update_event.cpp
reflexion-0.1.9.1 .doc/ext/reflex/update_event.cpp
reflexion-0.1.9 .doc/ext/reflex/update_event.cpp
reflexion-0.1.8 .doc/ext/reflex/update_event.cpp