Package tiled.core

Examples of tiled.core.Tile


    }

    public Tile createCell(int tx, int ty, int start, int len, boolean all) {
        Cell c = new Cell(myMap, tx, ty, start, len, all);
        Iterator itr = cells.iterator();
        Tile tile;

        while (itr.hasNext()) {
            Cell check = (Cell)itr.next();
            if (check.equals(c)) {
                return check.getTile();
            }
        }

        cells.add(c);

        tile = new Tile();
        c.setTile(tile);

        //GENERATE MERGED TILE IMAGE
        //FIXME: although faster, the following doesn't seem to handle alpha on some platforms...
        GraphicsConfiguration config =
            GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
        Image tileImg = config.createCompatibleImage(c.getWidth(), c.getHeight());
        c.render(tileImg.getGraphics());
        tile.setImage(tileImg);

        myTs.addTile(tile);

        return tile;
    }
View Full Code Here


        }

        public void render(Graphics g) {
            Iterator itr = sandwich.iterator();
            while (itr.hasNext()) {
                Tile t = (Tile)itr.next();
                if (t != null) t.draw(g, 0, getHeight(), 1.0f);
            }
        }
View Full Code Here

        public boolean equals(Cell c) {
            Iterator me = sandwich.iterator();
            Iterator them = c.sandwich.iterator();
            while (me.hasNext()) {
                Tile m = (Tile)me.next();
                Tile t = (Tile)them.next();
                if ((m != null && t != null) && !m.equals(t)) {
                    return false;
                } else if (m != null && t != null && t != m) {
                    return false;
                } else if ((m != null && t == null) || (m == null && t != null)) {
View Full Code Here

        public int getWidth() {
            int width = 0;
            Iterator itr = sandwich.iterator();
            while (itr.hasNext()) {
                Tile t = (Tile)itr.next();
                if (t != null) {
                    int w = t.getWidth();
                    if (w > width) width = w;
                }
            }
            return width;
        }
View Full Code Here

        public int getHeight() {
            int height = 0;
            Iterator itr = sandwich.iterator();
            while (itr.hasNext()) {
                Tile t = (Tile)itr.next();
                if (t != null) {
                    int h = t.getHeight();
                    if (h > height) height = h;
                }
            }
            return height;
        }
View Full Code Here

            // 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));
                    }
                }
            }
View Full Code Here

        super.getListCellRendererComponent(
                list, value, index, isSelected, cellHasFocus);

        // Attempt to set an appropriate icon
        if (value instanceof Tile && index >= 0) {
            Tile tile = (Tile) value;
            if (!isSelected || zoom == 1) {
                // Use cached ImageIcon instance
                final Integer key = new Integer(index);
                if (tileImages.containsKey(key)) {
                    setIcon((Icon) tileImages.get(key));
                } else {
                    Icon icon = new ImageIcon(tile.getScaledImage(zoom));
                    setIcon(icon);
                    tileImages.put(key, icon);
                }
            } else {
                // Selected entry always uses unscaled image
                setIcon(new ImageIcon(tile.getImage()));
            }
        } else if (value instanceof TileSet) {
            setIcon(setIcon);
        }
View Full Code Here

        getContentPane().add(mainPanel);
        getRootPane().setDefaultButton(okButton);
    }

    private void createFromOptions() {
        Tile t = null;

        if (myBrush instanceof ShapeBrush) {
            t = ((ShapeBrush)myBrush).getTile();
        }
View Full Code Here

        // Draw this map layer
        for (int y = 0; y < rows; y++) {
            Point columnItr = new Point(rowItr);

            for (int x = 0; x < columns; x++) {
                Tile tile = layer.getTileAt(columnItr.x, columnItr.y);

                if (tile != null) {
                    if (layer instanceof SelectionLayer) {
                        //Polygon gridPoly = createGridPolygon(
                                //drawLoc.x, drawLoc.y - tileSize.height, 0);
                        gridPoly.translate(drawLoc.x, drawLoc.y);
                        g2d.fillPolygon(gridPoly);
                        gridPoly.translate(-drawLoc.x, -drawLoc.y);
                        //paintEdge(g2d, layer, drawLoc.x, drawLoc.y);
                    } else {
                        tile.draw(g2d, drawLoc.x, drawLoc.y, zoom);
                    }
                }

                // Advance to the next tile
                columnItr.x++;
View Full Code Here

        // Draw this map layer
        for (int y = startY, gy = (startY + 1) * tsize.y;
                y < endY; y++, gy += tsize.y) {
            for (int x = startX, gx = startX * tsize.x;
                    x < endX; x++, gx += tsize.x) {
                Tile tile = layer.getTileAt(x, y);
                if (tile != null) {
                    if (layer instanceof SelectionLayer) {
                      if (shouldPaintBrushTile())
                        RenderingUtil.drawTile(gc, tile, gx, gy, zoom);
                        Transform transform = new Transform(getDisplay());
View Full Code Here

TOP

Related Classes of tiled.core.Tile

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.