Examples of CTileset


Examples of de.yaams.extensions.diamant.tileset.CTileset

   * @return
   * @throws IOException
   */
  protected TileSet buildTileset(int id, Project p) throws IOException {
    // load tileset
    CTileset ct = (CTileset) p.getObjects().get("tileset").getObjects().get(id);

    // build tileset
    TileSet tileset = new TileSet();

    BufferedImage b = ct.getTilesetGraphic(p);

    // add tileset
    // add tiles
    for (int i = 0, l = b.getWidth() / 32 * (b.getHeight() / 32); i < l; i++) {
      Tile t = new Tile();
      t.setId(i);
      t.setImage(b.getSubimage(i % (b.getWidth() / 32) * 32, i / (b.getWidth() / 32) * 32, 32, 32));
      t.setTileSet(tileset);
      tileset.addTile(t);
    }

    tileset.setName(ct.getTitle());

    return tileset;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.