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.
Creates a new Tile. (tile_x;tile_y) is the position on the tileset, while (x;y) is the position on the map.
/* 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; }
Returns the tile’s abscissa on the tileset.
/* 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.
/* 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.
/* 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.
/* 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.
/* Returns the tile's tileset id. */ VALUE Tile_tileset(VALUE self) { return INT2FIX(getRef<GameMap::Tile>(self).tileset); }
Sets the tile’s tileset id.
/* 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.
/* 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.
/* 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.
/* Returns the tile's abscissa. */ VALUE Tile_x(VALUE self) { return INT2FIX(getRef<GameMap::Tile>(self).x); }
Sets the tile’s abscissa.
/* 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; }