Package de.yaams.extensions.basemap.tiled.core

Examples of de.yaams.extensions.basemap.tiled.core.TileLayer


    Rectangle shapeBounds = shape.getBounds();
    int centerx = x - shapeBounds.width / 2;
    int centery = y - shapeBounds.height / 2;

    for (int i = 0; i < numLayers; i++) {
      TileLayer tl = (TileLayer) affectedMp.getLayer(initLayer - i);
      if (tl != null) {
        for (int cy = 0; cy <= shapeBounds.height; cy++) {
          for (int cx = 0; cx < shapeBounds.width; cx++) {
            if (shape.contains(cx, cy) && mt.genrand() % 101 <= 100 * ratio) {
              tl.setTileAt(cx + centerx, cy + centery, paintTile);
            }
          }
        }
      }
    }
View Full Code Here


    IRubyObject[] data = ((RubyArray) ((RubyObject) o.getInstanceVariable("@data")).getInstanceVariable("@data")).toJavaArray();
    final String[] names = { "Down", "Middle", "Up" };
    int z = 0;

    for (final String a : names) {
      final TileLayer l = (TileLayer) m.addLayer();
      l.setName(a);
      // set tiles
      for (int x = 0, u = m.getWidth(); x < u; x++) {
        for (int y = 0, v = m.getHeight(); y < v; y++) {

          int tid = Integer.valueOf(data[x + y * u + z * u * v].toString());
          // get id
          if (tid < 384) {
            l.setTileAt(x, y, autotiles.getTile(tid));
          } else {
            // t.setId(((Long) data[x + y * u + z * u * v]);
            l.setTileAt(x, y, tileset.getTile(tid - 384));
          }
        }
      }
      z++;
    }
View Full Code Here

    if (ret == JOptionPane.YES_OPTION) {
      TileMergeHelper tmh = new TileMergeHelper(map);
      int len = map.getTotalLayers();
      // TODO: Add a dialog option: "Yes, visible only"
      TileLayer newLayer = tmh.merge(0, len, true);
      map.removeAllLayers();
      map.addLayer(newLayer);
      newLayer.setName("Merged Layer");
      map.addTileset(tmh.getSet());
      editor.setCurrentLayer(0);
    } else if (ret == JOptionPane.NO_OPTION) {
      while (map.getTotalLayers() > 1) {
        map.mergeLayerDown(editor.getCurrentLayerIndex());
View Full Code Here

    propertiesCoordinates.clear();

    // Get all properties of all selected tiles...
    MapLayer ml = editor.getCurrentLayer();
    if (ml instanceof TileLayer) {
      TileLayer tl = (TileLayer) ml;
      Rectangle r = selection.getSelectedAreaBounds();
      int maxJ = (int) (r.getY() + r.getHeight());
      int maxI = (int) (r.getX() + r.getWidth());

      // todo: BL - Why are tiles checked on null? Surely whether a tile
      // todo: is null or not has nothing to do with whether you can place
      // todo: a property as a certain location?
      for (int j = (int) r.getY(); j < maxJ; j++) {
        for (int i = (int) r.getX(); i < maxI; i++) {
          Tile t = selection.getTileAt(i, j);
          if (t != null) {
            propertiesCoordinates.add(new Point(i, j));
          }
        }
      }

      if (!propertiesCoordinates.isEmpty()) {
        // Start with properties of first tile instance
        Point point = propertiesCoordinates.get(0);
        Properties p = tl.getTileInstancePropertiesAt(point.x, point.y);

        if (p != null) {
          mergedProperties.putAll(p);

          for (int i = 1; i < propertiesCoordinates.size(); i++) {
            // Merge the other properties...
            point = propertiesCoordinates.get(i);
            p = tl.getTileInstancePropertiesAt(point.x, point.y);

            if (p != null) {
              for (Enumeration<?> e = mergedProperties.keys(); e.hasMoreElements();) {
                // We only care for properties that are already
                // "known"...
View Full Code Here

TOP

Related Classes of de.yaams.extensions.basemap.tiled.core.TileLayer

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.