Method: Ray::Rect#initialize
- Defined in:
- ext/rect.c
#initialize(x, y) ⇒ Object #initialize(x, y, w, h) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'ext/rect.c', line 48
static
VALUE ray_init_rect(int argc, VALUE *argv, VALUE self) {
VALUE x, y, w, h;
rb_scan_args(argc, argv, "22", &x, &y, &w, &h);
say_rect *rect;
Data_Get_Struct(self, say_rect, rect);
rect->x = NUM2DBL(x);
rect->y = NUM2DBL(y);
if (!NIL_P(w)) {
rect->w = NUM2DBL(w);
rect->h = NUM2DBL(h);
}
else {
rect->w = 0;
rect->h = 0;
}
return Qnil;
}
|