Class Joyau::Triangle
In: Drawable.cpp
Parent: Joyau::Shape

Drawable used for triangles.

Methods

getPoints   points   setPoints  

Public Instance methods

Returns the triangle’s position.

[Source]

/*
  Returns the triangle's position.
*/
VALUE Triangle_getPoints(VALUE self)
{
   Triangle &ref = getRef<Triangle>(self);
   Point *points = ref.getPoints();

   VALUE hash = rb_ary_new();
   for (int i = 0; i < 3; ++i)
      rb_ary_push(hash, createObject(getClass("Point"), points[i]));

   return hash;
}
points()

Alias for getPoints

Sets the triangle’s position.

[Source]

/*
  call-seq: setPoints(x1, y1, x2, y2, x3, y3)

  Sets the triangle's position.
*/
VALUE Triangle_setPoints(VALUE self, VALUE x1, VALUE y1, VALUE x2, VALUE y2,
                         VALUE x3, VALUE y3)
{
   Triangle &ref = getRef<Triangle>(self);

   int _x1 = INT2FIX(x1);
   int _x2 = INT2FIX(x2);
   int _x3 = INT2FIX(x3);

   int _y1 = INT2FIX(y1);
   int _y2 = INT2FIX(y2);
   int _y3 = INT2FIX(y3);

   ref.setPoints(_x1, _y1, _x2, _y2, _x3, _y3);
   return Qnil;
}

[Validate]