Sha256: ef53391ed3e6b635da0e2e0f53691cf232019ccafc894b03d9df84926f5e4cc5

Contents?: true

Size: 1.09 KB

Versions: 9

Compression:

Stored size: 1.09 KB

Contents

#include "reflex/ruby/shape.h"


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


RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(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

9 entries across 9 versions & 1 rubygems

Version Path
reflexion-0.1.38 .doc/ext/reflex/polygon_shape.cpp
reflexion-0.1.37 .doc/ext/reflex/polygon_shape.cpp
reflexion-0.1.36 .doc/ext/reflex/polygon_shape.cpp
reflexion-0.1.35 .doc/ext/reflex/polygon_shape.cpp
reflexion-0.1.34 .doc/ext/reflex/polygon_shape.cpp
reflexion-0.1.33 .doc/ext/reflex/polygon_shape.cpp
reflexion-0.1.32 .doc/ext/reflex/polygon_shape.cpp
reflexion-0.1.31 .doc/ext/reflex/polygon_shape.cpp
reflexion-0.1.30 .doc/ext/reflex/polygon_shape.cpp