Sha256: 644c98ccadef70f9d67f12db1246e311c1b18570cc269bb7dfc8fee330692e70

Contents?: true

Size: 1.23 KB

Versions: 21

Compression:

Stored size: 1.23 KB

Contents

#include "reflex/ruby/event.h"


#include <rays/ruby/point.h>
#include "defs.h"


RUCY_DEFINE_VALUE_FROM_TO(Reflex::MotionEvent)

#define THIS  to<Reflex::MotionEvent*>(self)

#define CHECK RUCY_CHECK_OBJ(Reflex::MotionEvent, self)


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

static
VALUE initialize(VALUE self, VALUE gravity)
{
	CHECK;

	*THIS = Reflex::MotionEvent(to<Rays::Point>(gravity));

	return rb_call_super(0, NULL);
}

static
VALUE initialize_copy(VALUE self, VALUE obj)
{
	CHECK;
	*THIS = to<Reflex::MotionEvent&>(obj).dup();
	return self;
}

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


static Class cMotionEvent;

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

	cMotionEvent = mReflex.define_class("MotionEvent", Reflex::event_class());
	rb_define_alloc_func(cMotionEvent, alloc);
	rb_define_private_method(cMotionEvent, "initialize", RUBY_METHOD_FUNC(initialize), 1);
	rb_define_private_method(cMotionEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
	rb_define_method(cMotionEvent, "gravity", RUBY_METHOD_FUNC(gravity), 0);
}


namespace Reflex
{


	Class
	motion_event_class ()
	{
		return cMotionEvent;
	}


}// Reflex

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
reflexion-0.2.1 .doc/ext/reflex/motion_event.cpp
reflexion-0.2 .doc/ext/reflex/motion_event.cpp
reflexion-0.1.57 .doc/ext/reflex/motion_event.cpp
reflexion-0.1.56 .doc/ext/reflex/motion_event.cpp
reflexion-0.1.55 .doc/ext/reflex/motion_event.cpp
reflexion-0.1.54 .doc/ext/reflex/motion_event.cpp
reflexion-0.1.53 .doc/ext/reflex/motion_event.cpp
reflexion-0.1.52 .doc/ext/reflex/motion_event.cpp
reflexion-0.1.51 .doc/ext/reflex/motion_event.cpp
reflexion-0.1.50 .doc/ext/reflex/motion_event.cpp
reflexion-0.1.49 .doc/ext/reflex/motion_event.cpp
reflexion-0.1.48 .doc/ext/reflex/motion_event.cpp
reflexion-0.1.47 .doc/ext/reflex/motion_event.cpp
reflexion-0.1.46 .doc/ext/reflex/motion_event.cpp
reflexion-0.1.45 .doc/ext/reflex/motion_event.cpp
reflexion-0.1.44 .doc/ext/reflex/motion_event.cpp
reflexion-0.1.43 .doc/ext/reflex/motion_event.cpp
reflexion-0.1.42 .doc/ext/reflex/motion_event.cpp
reflexion-0.1.41 .doc/ext/reflex/motion_event.cpp
reflexion-0.1.40 .doc/ext/reflex/motion_event.cpp