コード例 #1
0
ファイル: Map.java プロジェクト: cothong/tiled-java
 /**
  * Get the tile set that matches the given global tile id, only to be used when loading a map.
  *
  * @param gid a global tile id
  * @return the tileset containing the tile with the given global tile id, or <code>null</code>
  *     when no such tileset exists
  */
 public TileSet findTileSetForTileGID(int gid) {
   TileSet has = null;
   for (TileSet tileset : tilesets) {
     if (tileset.getFirstGid() <= gid) {
       has = tileset;
     }
   }
   return has;
 }
コード例 #2
0
 /**
  * Returns the global tile id by adding the tile id to the map-assigned.
  *
  * @return id
  */
 public int getGid() {
   if (tileset != null) {
     return id + tileset.getFirstGid();
   }
   return id;
 }