Package tiled.core

Examples of tiled.core.TileSet


        public void tilesetRemoved(MapChangedEvent e, int index) {
            TabItem tab = tabFolder.getItem(index);
            Control control = ((Composite) tab.getControl()).getChildren()[0];
            TilePalettePanel panel = (TilePalettePanel) control;
            TileSet set = panel.getTileset();
            panel.removeTileSelectionListener(TabbedTilesetsPane.this);
            set.removeTilesetChangeListener(listener);
            tilePanels.remove(set);
            removeTabAt(index);
        }
View Full Code Here


        public void tilesetChanged(TilesetChangedEvent event) {
        }

        public void nameChanged(TilesetChangedEvent event, String oldName, String newName) {
            TileSet set = event.getTileset();
            int index = map.getTilesets().indexOf(set);

            tabFolder.getItem(index).setText(newName);
        }
View Full Code Here

    private Vector<Cell> cells;

    public TileMergeHelper(Map map) {
        myMap = map;
        cells = new Vector();
        myTs = new TileSet();
        myTs.setName("Merged Set");
    }
View Full Code Here

     * @return A new TileSet, loaded from the specified file by a plugin
     * @throws Exception
     * @see TMXMapReader#readTileset(String)
     */
    public static TileSet loadTileset(String file) throws Exception {
        TileSet ret = null;
        try {
            TMXMapReader mr;
            if (file.endsWith(".tsx")) {
                // Override, so people can't overtake our format
                mr = new TMXMapReader();
            } else {
                mr = (TMXMapReader)pluginLoader.getReaderFor(file);
            }

            if (mr != null) {
                PluginLogger logger = new PluginLogger();
//                mr.setLogger(logger);
                ret = mr.readTileset(file);
                ret.setSource(file);
                reportPluginMessages(logger);
            } else {
                throw new Exception("Unsupported tileset format");
            }
        } catch (IOException e) {
View Full Code Here

    String heightTxt = tileHeightCombo.getText();
    if (!widthTxt.isEmpty() && !heightTxt.isEmpty()) {
    dialog.setInitialTileSize(Integer.parseInt(widthTxt),Integer.parseInt(heightTxt));
    }
    dialog.open();
    TileSet result = dialog.getResult();
    if (result != null)
      tilesetsField.addElement(result);
  }
View Full Code Here

  protected void appendTilesets(Document newDoc, Element rootElement) {
    List<?> elements = tilesetsField.getElements();
    int gid = 1;
    for (Object object : elements) {
      TileSet tileSet = (TileSet) object;
      Element tileSetElement = newDoc.createElement("tileset");
      tileSetElement.setAttribute("name",tileSet.getName());
      tileSetElement.setAttribute("firstgid","" + gid);
      tileSetElement.setAttribute("tilewidth",tileWidthCombo.getText());
      tileSetElement.setAttribute("tileheight",tileHeightCombo.getText());
      Element imageElement = newDoc.createElement("image");
      IWorkspace workspace = ResourcesPlugin.getWorkspace()
       
      IPath resourcePath = workspace.getRoot().getLocation().append(getContainerFullPath().append(
          getFileName()));
      String relativePath = Util.getRelativePath(resourcePath.toOSString(),tileSet.getTilebmpFile());
      imageElement.setAttribute("source",relativePath);
      tileSetElement.appendChild(imageElement);
      rootElement.appendChild(tileSetElement);
      gid++;
    }
View Full Code Here

    imagePath = null;
  }
 
  public TileSet getResult() {
    if (isValid()) {
      TileSet tileSet = new TileSet();
      tileSet.setName(name);
      tileSet.setTilesetImageFilename(imagePath);
      tileSet.setTileMargin(margin);
      tileSet.setTileSpacing(spacing);
      return tileSet;
    }
    return null;
  }
View Full Code Here

    return null;
  }
 
  public TileSet getCuttedResult() {
    if (isValid()) {
      TileSet newTileset = new TileSet();
          newTileset.setName(name);

              final String file = imagePath;
              final int width = tileWidth;
              final int height = tileHeight;

              try {
//                  if (transCheck.isSelected()) {
//                      Color color = colorButton.getColor();
//                      newTileset.setTransparentColor(color);
//                  }

                  newTileset.importTileBitmap(file,
                          new BasicTileCutter(width, height, spacing, margin));
                  return newTileset;
              }
              catch (IOException e) {
                MessageDialog.openError(getParentShell(),"Error importing tileset",IMPORT_ERROR_MSG);
View Full Code Here

TOP

Related Classes of tiled.core.TileSet

Copyright © 2018 www.massapicom. 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.