Sha256: f70034ee0f38d26cca5ca3110ed9980d1e5113e3f4b9353ee61fc6ee33e628cf

Contents?: true

Size: 1.1 KB

Versions: 5

Compression:

Stored size: 1.1 KB

Contents

#include "reflex/ruby/shape.h"


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


RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(REFLEX_EXPORT, Reflex::PolygonShape)

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

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

#define CALL(fun) RUCY_CALL_SUPER(THIS, fun)


static
VALUE alloc(VALUE klass)
{
	return value(new Reflex::RubyShape<Reflex::PolygonShape>, klass);
}

static
VALUE set_polygon(VALUE self, VALUE polygon)
{
	CHECK;

	THIS->set_polygon(to<Rays::Polygon&>(polygon));
	return polygon;
}

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


static Class cPolygonShape;

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

	cPolygonShape = mReflex.define_class("PolygonShape", Reflex::shape_class());
	rb_define_alloc_func(cPolygonShape, alloc);
	rb_define_method(cPolygonShape, "polygon=", RUBY_METHOD_FUNC(set_polygon), 1);
	rb_define_method(cPolygonShape, "polygon", RUBY_METHOD_FUNC(get_polygon), 0);
}


namespace Reflex
{


	Class
	polygon_shape_class ()
	{
		return cPolygonShape;
	}


}// Reflex

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
reflexion-0.3.4 .doc/ext/reflex/polygon_shape.cpp
reflexion-0.3.3 .doc/ext/reflex/polygon_shape.cpp
reflexion-0.3.2 .doc/ext/reflex/polygon_shape.cpp
reflexion-0.3.1 .doc/ext/reflex/polygon_shape.cpp
reflexion-0.3 .doc/ext/reflex/polygon_shape.cpp