Class: SDL2::Point
- Inherits:
-
Object
- Object
- SDL2::Point
- Defined in:
- ext/sdl2_ext/video.c,
ext/sdl2_ext/video.c
Overview
This class represents a point in SDL library. Some method requires this method.
Instance Attribute Summary collapse
-
#x ⇒ Integer
X coordinate of the point.
-
#y ⇒ Integer
Y coordinate of the point.
Instance Method Summary collapse
-
#initialize(*args) ⇒ SDL2::Point
constructor
Create a new point object.
-
#inspect ⇒ String
Return inspection string.
Constructor Details
#initialize(x, y) ⇒ SDL2::Point #initialize ⇒ SDL2::Point
Create a new point object.
3148 3149 3150 3151 3152 3153 3154 3155 3156 |
# File 'ext/sdl2_ext/video.c', line 3148
static VALUE Point_initialize(int argc, VALUE* argv, VALUE self)
{
VALUE x, y;
SDL_Point* point = Get_SDL_Point(self);
rb_scan_args(argc, argv, "02", &x, &y);
point->x = (x == Qnil) ? 0 : NUM2INT(x);
point->y = (y == Qnil) ? 0 : NUM2INT(y);
return Qnil;
}
|
Instance Attribute Details
#x ⇒ Integer
X coordinate of the point.
#y ⇒ Integer
Y coordinate of the point.
Instance Method Details
#inspect ⇒ String
Return inspection string.
3162 3163 3164 3165 3166 |
# File 'ext/sdl2_ext/video.c', line 3162
static VALUE Point_inspect(VALUE self)
{
SDL_Point* point = Get_SDL_Point(self);
return rb_sprintf("<SDL2::Point x=%d y=%d>", point->x, point->y);
}
|