Class | Joyau::Point |
In: |
Drawable.cpp
|
Parent: | Object |
Creates a new Point.
/* 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; }
Returns whether two points represents the same one (i.e. they have the same coordinates).
/* 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.
/* Returns a point's abscissa. */ VALUE Point_getX(VALUE self) { Point &ref = getRef<Point>(self); return INT2FIX(ref.x); }
Sets a point’s abscissa.
/* 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; }