Package tiled.core

Examples of tiled.core.Map


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

    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


              Resources.getString("action.layer.delete.tooltip"),
              Resources.getIcon("gnome-delete.png"));
    }

    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

              Resources.getString("action.layer.add.tooltip"),
              Resources.getIcon("gnome-new.png"));
    }

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

                "Add a Zone Group",
                Resources.getIcon("gnome-new.png"));
    }

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

              Resources.getIcon("gimp-duplicate-16.png"));
    }

    protected void doPerformAction() {
        MapLayer currentLayer = editor.getCurrentLayer();
        Map currentMap = editor.getCurrentMap();

        if (currentLayer != null) {
            try {
                MapLayer clone = (MapLayer) currentLayer.clone();
                String newName = Resources.getString(
                        "action.layer.duplicate.newlayer.name");
                clone.setName(MessageFormat.format(newName, new Object[]{clone.getName()}));
                currentMap.addLayer(clone);
                editor.setCurrentLayer(currentMap.getTotalLayers() - 1);
            } catch (CloneNotSupportedException ex) {
                ex.printStackTrace();
            }
        }
    }
View Full Code Here

              Resources.getString("action.unitgroup.add.tooltip"),
              Resources.getIcon("gnome-new.png"));
    }

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

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

    public void actionPerformed (ActionEvent e)
    {
        Map currentMap = editor.getCurrentMap();
        String filePath = currentMap.getFilename();

        // todo: Fix the case where the plugin cannot be determined by the
        // todo: current filename. This can happen when the user has used
        // todo: "Save As" to save the file using a non-standard extension.
        if (filePath != null) {
View Full Code Here

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

    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

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

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

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

    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

TOP

Related Classes of 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.