Sha256: 74df86bf0720d34629677bb34a4c09bec774008ce6225f9a21a228a78abad8b0

Contents?: true

Size: 1.7 KB

Versions: 2

Compression:

Stored size: 1.7 KB

Contents

#include "reflex/ruby/event.h"


#include "reflex/ruby/shape.h"
#include "reflex/ruby/view.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
RUCY_DEF_ALLOC(alloc, klass)
{
	return new_type<Reflex::ContactEvent>(klass);
}
RUCY_END

static
RUCY_DEF2(initialize, type, shape)
{
	CHECK;

	THIS->type  = (Reflex::ContactEvent::Type) to<int>(type);
	THIS->shape = to<Reflex::Shape*>(shape);

	return rb_call_super(0, NULL);
}
RUCY_END

static
RUCY_DEF1(initialize_copy, obj)
{
	CHECK;
	*THIS = to<Reflex::ContactEvent&>(obj);
	return self;
}
RUCY_END

static
RUCY_DEF0(get_type)
{
	CHECK;
	return value(THIS->type);
}
RUCY_END

static
RUCY_DEF0(get_shape)
{
	CHECK;
	return value(THIS->shape);
}
RUCY_END

static
RUCY_DEF0(get_view)
{
	CHECK;
	return value(THIS->view);
}
RUCY_END


static Class cContactEvent;

void
Init_contact_event ()
{
	Module mReflex = define_module("Reflex");

	cContactEvent = mReflex.define_class("ContactEvent", Reflex::event_class());
	cContactEvent.define_alloc_func(alloc);
	cContactEvent.define_private_method("initialize",      initialize);
	cContactEvent.define_private_method("initialize_copy", initialize_copy);
	cContactEvent.define_method("type",  get_type);
	cContactEvent.define_method("shape", get_shape);
	cContactEvent.define_method("view",  get_view);
	cContactEvent.define_const("TYPE_NONE",  Reflex::ContactEvent::NONE);
	cContactEvent.define_const("TYPE_BEGIN", Reflex::ContactEvent::BEGIN);
	cContactEvent.define_const("TYPE_END",   Reflex::ContactEvent::END);
}


namespace Reflex
{


	Class
	contact_event_class ()
	{
		return cContactEvent;
	}


}// Reflex

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reflexion-0.1.23 ext/reflex/contact_event.cpp
reflexion-0.1.22 ext/reflex/contact_event.cpp