Class: SDL2::Point

Inherits:
Object
  • Object
show all
Defined in:
video.c,
video.c

Overview

This class represents a point in SDL library. Some method requires this method.

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (SDL2::Point) initialize(x, y) - (SDL2::Point) initialize

Create a new point object.

Overloads:

  • - (SDL2::Point) initialize(x, y)

    Parameters:

    • x

      the x coordinate of the point

    • y

      the y coordinate of the point

  • - (SDL2::Point) initialize

    x and y of the created point object are initialized by 0



2454
2455
2456
2457
2458
2459
2460
2461
2462
# File 'video.c', line 2454

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

- (Integer) x

X coordiante of the point.

Returns:

  • (Integer)

- (Integer) y

Y coordiante of the point.

Returns:

  • (Integer)

Instance Method Details

- (String) inspect

Return inspection string.

Returns:

  • (String)


2468
2469
2470
2471
2472
# File 'video.c', line 2468

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);
}