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

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


    putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke("shift PAGE_DOWN"));
  }

  @Override
  protected void doPerformAction() {
    Map map = editor.getCurrentMap();
    int layerIndex = editor.getCurrentLayerIndex();

    if (layerIndex > 0) {
      map.swapLayerDown(layerIndex);
      editor.setCurrentLayer(layerIndex - 1);
    }
  }
View Full Code Here


  }

  @Override
  protected void doPerformAction() {
    NewMapDialog nmd = new NewMapDialog(YaFrame.get());
    Map newMap = nmd.create();
    if (newMap != null) {
      editor.setCurrentMap(newMap);
    }
  }
View Full Code Here

        .getIcon("gnome-new.png"));
  }

  @Override
  protected void doPerformAction() {
    Map currentMap = editor.getCurrentMap();
    currentMap.addObjectGroup();
    editor.setCurrentLayer(currentMap.getTotalLayers() - 1);
  }
View Full Code Here

    putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke("shift control M"));
  }

  @Override
  protected void doPerformAction() {
    Map map = editor.getCurrentMap();
    int layerIndex = editor.getCurrentLayerIndex();

    if (layerIndex > 0) {
      map.mergeLayerDown(layerIndex);
      editor.setCurrentLayer(layerIndex - 1);
    }
  }
View Full Code Here

   *
   * @param filename
   *            Image filename to save map render to.
   */
  private void saveMapImage(String filename) {
    final Map currentMap = editor.getCurrentMap();
    final MapView myView = MapView.createViewforMap(currentMap);
    myView.setMode(MapView.PF_NOSPECIAL, true);

    // Take grid and zoom level from the current map view
    final MapView mapView = editor.getMapView();
View Full Code Here

    putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke("shift PAGE_UP"));
  }

  @Override
  protected void doPerformAction() {
    Map map = editor.getCurrentMap();
    int layerIndex = editor.getCurrentLayerIndex();
    int totalLayers = map.getTotalLayers();

    if (layerIndex < totalLayers - 1) {
      map.swapLayerUp(layerIndex);
      editor.setCurrentLayer(layerIndex + 1);
    }
  }
View Full Code Here

    // load map
    final RubyObject o = RGSS1Helper.get(p, Type.MAP).get(id).getObject();

    // build map
    final Map m = new Map(RubyHelper.toInt(o, "@width"), RubyHelper.toInt(o, "@height"));
    m.setFilename(RGSS1Load.getMapFile(project, id));
    m.setProject(project);
    m.setMid(id);

    TileSet autotiles = buildAutoTileset(RubyHelper.toInt(o, "@tileset_id"));
    m.addTileset(autotiles);

    TileSet tileset = buildTileset(RubyHelper.toInt(o, "@tileset_id"));
    m.addTileset(tileset);
    m.setTileHeight(32);
    m.setTileWidth(32);
    // tileset.

    // def [](x,y=0,z=0)
    // @data[x+y*@xsize+z*@xsize*@ysize]

    // build layers
    // load map data
    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));
View Full Code Here

   * before and after the action is performed.
   */
  @Override
  public final void actionPerformed(ActionEvent e) {
    // Capture the layers before the operation is executed.
    Map map = editor.getCurrentMap();
    Vector<MapLayer> layersBefore = new Vector<MapLayer>(map.getLayerVector());

    doPerformAction();

    // Capture the layers after the operation is executed and create the
    // layer state edit instance.
    Vector<MapLayer> layersAfter = new Vector<MapLayer>(map.getLayerVector());
    MapLayerStateEdit mapLayerStateEdit = new MapLayerStateEdit(map, layersBefore, layersAfter, e.getActionCommand());
    editor.getUndoSupport().postEdit(mapLayerStateEdit);
  }
View Full Code Here

    super(editor, Resources.getString("action.layer.mergeall.name"), Resources.getString("action.layer.mergeall.tooltip"));
  }

  @Override
  protected void doPerformAction() {
    Map map = editor.getCurrentMap();

    int ret = JOptionPane.showConfirmDialog(editor.getAppFrame(), "Do you wish to merge tile images, and create a new tile set?",
        "Merge Tiles?", JOptionPane.YES_NO_CANCEL_OPTION);

    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());
      }
      editor.setCurrentLayer(0);
    }
  }
View Full Code Here

        .getIcon("gnome-delete.png"));
  }

  @Override
  protected void doPerformAction() {
    Map map = editor.getCurrentMap();
    int layerIndex = editor.getCurrentLayerIndex();
    int totalLayers = map.getTotalLayers();

    if (layerIndex >= 0) {
      map.removeLayer(layerIndex);

      // If the topmost layer was selected, the layer index is invalid
      // after removing that layer. The right thing to do is to reset it
      // to the new topmost layer.
      if (layerIndex == totalLayers - 1) {
View Full Code Here

TOP

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

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.