Class Joyau::Point
In: Drawable.cpp
Parent: Object

Methods

==   new   x   x=   y   y=  

Public Class methods

Creates a new Point.

[Source]

/*
  call-seq: Joyau::Point.new
            Joyau::Point.new(x, y)

  Creates a new Point.
*/
VALUE wrap<Point>(int argc, VALUE *argv, VALUE info)
{
   Point *ptr = new Point;

   VALUE x, y;
   rb_scan_args(argc, argv, "02", &x, &y);

   if (!NIL_P(x) && !NIL_P(y))
   {
      ptr->x = FIX2INT(x);
      ptr->y = FIX2INT(y);
   }

   VALUE tdata = Data_Wrap_Struct(info, 0, wrapped_free<Point>, ptr);
   return tdata;
}

Public Instance methods

Returns whether two points represents the same one (i.e. they have the same coordinates).

[Source]

/*
  call-seq: point1 == point2

  Returns whether two points represents the same one (i.e. they have the same
  coordinates).
*/
VALUE Point_eq(VALUE self, VALUE op)
{
   Point &first = getRef<Point>(self);
   Point &second = getRef<Point>(op);

   return first == second ? Qtrue : Qfalse;
}

Returns a point’s abscissa.

[Source]

/*
  Returns a point's abscissa.
*/
VALUE Point_getX(VALUE self)
{
   Point &ref = getRef<Point>(self);
   return INT2FIX(ref.x);
}

Sets a point’s abscissa.

[Source]

/*
  call-seq: x=(x)

  Sets a point's abscissa.
*/
VALUE Point_setX(VALUE self, VALUE val)
{
   Point &ref = getRef<Point>(self);
   int _val = FIX2INT(val);
   
   ref.x = _val;
   return val;
}

Returns a point’s ordinate.

[Source]

/*
  Returns a point's ordinate.
*/
VALUE Point_getY(VALUE self)
{
   Point &ref = getRef<Point>(self);
   return INT2FIX(ref.y);
}

Sets a point’s ordinate.

[Source]

/*
  call-seq: y=(y)

  Sets a point's ordinate.
*/
VALUE Point_setY(VALUE self, VALUE val)
{
   Point &ref = getRef<Point>(self);
   int _val = FIX2INT(val);
   
   ref.y = _val;
   return val;
}

[Validate]