Package com.jcloisterzone.board

Examples of com.jcloisterzone.board.Rotation


    public void castleDeployed(Castle castle1, Castle castle2) {
        Position p1 = castle1.getTile().getPosition();
        Position p2 = castle2.getTile().getPosition();
        Position pos;
        Rotation rot;

        if (p1.x == p2.x) {
            pos = p1.y < p2.y ? p1 : p2;
            rot = Rotation.R0;
        } else {
View Full Code Here


            case "apply":
                String[] tokens = child.getTextContent().split(" ");
                FeatureDescriptor fd =  FeatureDescriptor.valueOf(tokens[0], root.getAttribute("feature"), tokens[1]);
                AffineTransform af = getTransform();
                if (baseLocation != null) {
                    Rotation rotate = fd.getLocation().getRotationOf(baseLocation);
                    af.concatenate(rotate.getAffineTransform(ResourcePlugin.NORMALIZED_SIZE));
                }
                handler.processApply(child, fd, af);
                if (XmlUtils.attributeBoolValue(child, "allRotations")) {
                    Rotation rot = Rotation.R90;
                    for (int ri = 0; ri < 3; ri++) {
                        Location rotatedLoc = fd.getLocation().rotateCW(rot);
                        FeatureDescriptor rotatedFd = new FeatureDescriptor(fd.getTileId(), fd.getFeatureType(), rotatedLoc);
                        af.concatenate(Rotation.R90.getAffineTransform(ResourcePlugin.NORMALIZED_SIZE));
                        handler.processApply(child, rotatedFd, af);
                        rot = rot.next();
                    }
                }
                break;
            case "substract":
                assert baseLocation == null : "baseLocation is not allowed together with substraction element";
View Full Code Here

    private void drawFeature(Graphics2D g2, Feature feature) {
        Location loc = feature.getRawLocation();
        //System.out.println(feature + " / " + loc);
        for (Location base : BASE_ROTATIONS) {
            Rotation rot = loc.getRotationOf(base);
            if (rot != null) {
                String path = feature.getClass().getSimpleName().toLowerCase();
                Image img = getImageResource("tiles/"+path+"/"+base.toString()+".png");
                g2.drawImage(img, rot.getAffineTransform(SIZE), null);
                break;
            }
        }
    }
View Full Code Here

        fd[alias == null ? 1 : 2] = new FeatureDescriptor(FeatureDescriptor.EVERY, featureType, location);
        return fd;
    }

    public Area getArea(Tile tile, Class<? extends Feature> featureClass, Location loc) {
        Rotation tileRotation = tile.getRotation();
        if (featureClass != null && featureClass.equals(Bridge.class)) {
            Area a =  getBridgeArea(loc.rotateCCW(tileRotation));
            //bridge is independent on tile rotation
            if ((loc == Location.WE && (tileRotation == Rotation.R90 || tileRotation == Rotation.R180)) ||
                (loc == Location.NS && (tileRotation == Rotation.R180 || tileRotation == Rotation.R270))) {
View Full Code Here

TOP

Related Classes of com.jcloisterzone.board.Rotation

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.