Examples of EnhancedTile


Examples of org.iremake.client.ui.map.EnhancedTile

            Image inner = IOManager.getAsImage(Places.GraphicsScenario, base + "/" + child.getAttributeValue("inner"));
            Image outer = inner;
            if (child.hasAttribute("outer")) {
                outer = IOManager.getAsImage(Places.GraphicsScenario, base + "/" + child.getAttributeValue("outer"));
            }
            tile.content = new EnhancedTile(inner, outer);
            tile.color = GraphicsUtils.convertHexToColor(child.getAttributeValue("color"));

           
            terrainTiles.put(id, tile);
        }

        for (Tile tile : terrainTiles.values()) {
            Dimension size = tile.content.getSize();
            if (!tileSize.equals(size)) {
                RuntimeException ex = new RuntimeException("Terrain tiles differ in size");
                LOG.log(Level.SEVERE, null, ex);
                throw ex;
            }
        }

        {
            // import river overlay
            element = parent.getFirstChild("River-Overlays");
            String location = element.getAttributeValue("location");
            BufferedImage rivers = IOManager.getAsImage(Places.GraphicsScenario, location);
            // test if width and height is a multiple of tileSize
            if (rivers.getWidth(null) % tileSize.width != 0 || rivers.getHeight(null) % tileSize.height != 0) {
                // LOG
            }
            int columns = rivers.getWidth(null) / tileSize.width;
            int rows = rivers.getHeight(null) / tileSize.height;
            // image too small
            if (rows * columns < 36) {
            }
            // lets copy out the parts and store them
            riverOverlays = new Image[36];
            for (int i = 0; i < 36; i++) {
                int x = i % 8 * tileSize.width;
                int y = i / 8 * tileSize.height;
                riverOverlays[i] = rivers.getSubimage(x, y, tileSize.width, tileSize.height);
            }
        }

        // import resource overlays
        element = parent.getFirstChild("Resource-Overlays");

        base = element.getAttributeValue("base");

        for (Node child : element.getChildren()) {
            child.checkNode("Overlay");

            Integer id = child.getAttributeValueAsInt("id");
            // TODO what if images cannot be loaded because they aren't there, image == null, check
            Image inner = IOManager.getAsImage(Places.GraphicsScenario, base + "/" + child.getAttributeValue("inner"));
            Image outer = inner;
            if (child.hasAttribute("outer")) {
                outer = IOManager.getAsImage(Places.GraphicsScenario, base + "/" + child.getAttributeValue("outer"));
            }           
            resourceOverlays.put(id, new EnhancedTile(inner, outer));
        }

        // import misc overlays
        element = parent.getFirstChild("Miscellaneous-Overlays");

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.