Пример #1
0
/*
  @overload sheet_pos=(pos)

  Sets which cell of the sprite sheet should be displayed.
  sprite.sheet_pos = [0, 1] # Uses the first cell of the second line.

  pos.x and pos.y are rounded to floor.
  Passing a too high value will make the sprite use the previous cells.

    sprite.sheet_size = [4, 4]

    sprite.sheet_pos = [5, 5]
    sprite.sheet_pos == [1, 1] # => true
*/
static
VALUE ray_sprite_set_sheet_pos(VALUE self, VALUE size) {
  say_sprite *sprite = ray_rb2sprite(self);

  if (say_sprite_uses_sprite_sheet(sprite))
    say_sprite_set_sheet_pos(ray_rb2sprite(self), ray_convert_to_vector2(size));
  else
    rb_raise(rb_eRuntimeError, "sprite sheet not enabled on this sprite");

  return size;
}
Пример #2
0
/*
  @overload sheet_size=(size)

  Sets the size of the sprite sheet. For instance,
    sprite.sheet_size = [3, 4]
  would mean there are 4 rows and 3 columns in the sprite (and each cell
  has the same size).
*/
static
VALUE ray_sprite_set_sheet_size(VALUE self, VALUE size) {
  say_sprite_set_sheet_size(ray_rb2sprite(self), ray_convert_to_vector2(size));
  return size;
}
Пример #3
0
/*
  @overload pos=(val)
    Sets the position of the drawable.
    @see #pos
    @param [Ray::Vector2] val The new position of the drawable
*/
static
VALUE ray_drawable_set_pos(VALUE self, VALUE val) {
  say_drawable_set_pos(ray_rb2drawable(self), ray_convert_to_vector2(val));
  return val;
}