Class Joyau::Tile
In: Drawable.cpp
Parent: Object

This class is mainly used in GameMap, where it is a part of a tileset, drawn on the screen.

Methods

new   tileX   tileX=   tileY   tileY=   tileset   tileset=   type   type=   x   x=   y   y=  

Public Class methods

Creates a new Tile. (tile_x;tile_y) is the position on the tileset, while (x;y) is the position on the map.

[Source]

/*
  call-seq: new
            new(tileset_id, tile_x, tile_y, x, y [, colllision_type])

  Creates a new Tile. (tile_x;tile_y) is the position on the tileset, while
  (x;y) is the position on the map.
*/
VALUE wrap<GameMap::Tile>(int argc, VALUE *argv, VALUE info)
{
   GameMap::Tile *ptr = new GameMap::Tile;
   
   if (argc >= 5)
   {
      ptr->tileset = FIX2INT(argv[0]);
      ptr->tileX = FIX2INT(argv[1]);
      ptr->tileY = FIX2INT(argv[2]);
      ptr->x = FIX2INT(argv[3]);
      ptr->y = FIX2INT(argv[4]);
      if (argc == 6)
         ptr->type = getRef<CollisionType>(argv[5]);
   }
   
   VALUE tdata = Data_Wrap_Struct(info, 0, wrapped_free<GameMap::Tile>, ptr);
   return tdata;
}

Public Instance methods

Returns the tile’s abscissa on the tileset.

[Source]

/*
  Returns the tile's abscissa on the tileset.
*/
VALUE Tile_tileX(VALUE self)
{
   return INT2FIX(getRef<GameMap::Tile>(self).tileX);
}

Sets the tile’s abscissa on the tileset.

[Source]

/*
  call-seq: tileX=(val)

  Sets the tile's abscissa on the tileset.
*/
VALUE Tile_setTileX(VALUE self, VALUE val)
{
   GameMap::Tile &ref = getRef<GameMap::Tile>(self);
   ref.tileX = FIX2INT(val);

   return val;
}

Returns the tile’s ordinate on the tileset.

[Source]

/*
  Returns the tile's ordinate on the tileset.
*/
VALUE Tile_tileY(VALUE self)
{
   return INT2FIX(getRef<GameMap::Tile>(self).tileY);
}

Sets the tile’s ordinate on the tileset.

[Source]

/*
  call-seq: tileY=(val)

  Sets the tile's ordinate on the tileset.
*/
VALUE Tile_setTileY(VALUE self, VALUE val)
{
   GameMap::Tile &ref = getRef<GameMap::Tile>(self);
   ref.tileY = FIX2INT(val);

   return val;
}

Returns the tile’s tileset id.

[Source]

/*
  Returns the tile's tileset id.
*/
VALUE Tile_tileset(VALUE self)
{
   return INT2FIX(getRef<GameMap::Tile>(self).tileset);
}

Sets the tile’s tileset id.

[Source]

/*
  call-seq: tileset=(val)

  Sets the tile's tileset id.
*/
VALUE Tile_setTileset(VALUE self, VALUE val)
{
   GameMap::Tile &ref = getRef<GameMap::Tile>(self);
   ref.tileset = FIX2INT(val);

   return val;
}

Returns the tile’s collision type.

[Source]

/*
  Returns the tile's collision type.
*/
VALUE Tile_type(VALUE self)
{
   GameMap::Tile &ref = getRef<GameMap::Tile>(self);
   return ref.type.toRuby();
}

Sets the tile’s collision type.

[Source]

/*
  call-seq: type=(val)

  Sets the tile's collision type.
*/
VALUE Tile_setType(VALUE self, VALUE val)
{
   GameMap::Tile &ref = getRef<GameMap::Tile>(self);
   CollisionType &type = getRef<CollisionType>(val);
   
   ref.type = type;
   return val;
}

Returns the tile’s abscissa.

[Source]

/*
  Returns the tile's abscissa.
*/
VALUE Tile_x(VALUE self)
{
   return INT2FIX(getRef<GameMap::Tile>(self).x);
}

Sets the tile’s abscissa.

[Source]

/*
  call-seq: x=(val)

  Sets the tile's abscissa.
*/
VALUE Tile_setX(VALUE self, VALUE val)
{
   GameMap::Tile &ref = getRef<GameMap::Tile>(self);
   ref.x = FIX2INT(val);

   return val;
}

Returns the tile’s ordinate.

[Source]

/*
  Returns the tile's ordinate.
*/
VALUE Tile_y(VALUE self)
{
   return INT2FIX(getRef<GameMap::Tile>(self).y);
}

Sets the tile’s ordinate.

[Source]

/*
  call-seq: y=(val)

  Sets the tile's ordinate.
*/
VALUE Tile_setY(VALUE self, VALUE val)
{
   GameMap::Tile &ref = getRef<GameMap::Tile>(self);
   ref.y = FIX2INT(val);

   return val;
}

[Validate]