Package com.jcloisterzone.ui

Examples of com.jcloisterzone.ui.ImmutablePoint


    public MeepleLayer(GridPanel gridPanel) {
        super(gridPanel);
    }

    private void paintPositionedImage(Graphics2D g, PositionedImage mi, int boxSize) {
        ImmutablePoint scaledOffset = mi.getScaledOffset(boxSize);
        //TODO optimize also for scrolling
        if (mi.scaledImage == null) {
            int size = (int) (getSquareSize() * FIGURE_SIZE_RATIO);
            Image img = mi.sourceImage.getScaledInstance(size, size, Image.SCALE_SMOOTH);
            mi.scaledImage = new ImageIcon(img).getImage();
        }
        g.drawImage(mi.scaledImage, getOffsetX(mi.position) + scaledOffset.getX(), getOffsetY(mi.position) + scaledOffset.getY(), gridPanel);
    }
View Full Code Here


        super.zoomChanged(squareSize);
    }

    private MeeplePositionedImage createMeepleImage(Class<? extends Meeple> type, Color c, FeaturePointer fp) {
        Feature feature = getGame().getBoard().get(fp);
        ImmutablePoint offset = getClient().getResourceManager().getMeeplePlacement(feature.getTile(), type, fp.getLocation());
        Image image = getClient().getFigureTheme().getFigureImage(type, c, getExtraDecoration(type, fp));
        if (fp.getLocation() == Location.ABBOT) {
            image = rotate(image, 90);
        }
        return new MeeplePositionedImage(type, fp, offset, image, feature instanceof Bridge);
View Full Code Here

             location = fp.getLocation();
             this.bridgePlacement = bridgePlacement;
         }

         public ImmutablePoint getScaledOffset(int boxSize) {
             ImmutablePoint point = offset;
             if (order > 0) {
                 point = point.translate(10*order, 0);
             }
             return point.scale(getSquareSize(), boxSize);
         }
View Full Code Here

    }

    public void scored(Feature scoreable, Player player, String points, Class<? extends Meeple> meepleType, boolean finalScoring) {
        Tile tile = scoreable.getTile();
        Position pos = tile.getPosition();
        ImmutablePoint offset = client.getResourceManager().getMeeplePlacement(tile, meepleType, scoreable.getLocation());
        animationService.registerAnimation(new ScoreAnimation(
            pos,
            points,
            offset,
            player.getColors().getMeepleColor(),
View Full Code Here

    public void scored(Position pos, Player player, String points, boolean finalScoring) {
        animationService.registerAnimation(new ScoreAnimation(
            pos,
            points,
            new ImmutablePoint(50, 50),
            player.getColors().getMeepleColor(),
            finalScoring ? null : getScoreAnimationDuration()
        ));

    }
View Full Code Here

        } else {
            c = player.getColors().getMeepleColor();
        }
        Image tunnelPiece = client.getFigureTheme().getTunnelImage(c);
        Tile tile = gridPanel.getTile(p);
        ImmutablePoint offset = client.getResourceManager().getMeeplePlacement(tile, SmallFollower.class, loc);
        meepleLayer.addPermanentImage(p, offset, tunnelPiece);
    }
View Full Code Here


    @Override
    public ImmutablePoint getMeeplePlacement(Tile tile, Class<? extends Meeple> type, Location loc) {
        for (ResourceManager manager : managers) {
            ImmutablePoint result = manager.getMeeplePlacement(tile, type, loc);
            if (result != null) return result;
        }
        return null;
    }
View Full Code Here

        return (new TileImageFactory()).getAbbeyImage();
    }


    private ImmutablePoint getBarnPlacement(Location loc) {
        if (loc.intersect(Location.NL.union(Location.WR)) != null) return new ImmutablePoint(0, 0);
        if (loc.intersect(Location.NR.union(Location.EL)) != null) return new ImmutablePoint(100, 0);
        if (loc.intersect(Location.SL.union(Location.ER)) != null) return new ImmutablePoint(100, 100);
        if (loc.intersect(Location.SR.union(Location.WL)) != null) return new ImmutablePoint(0, 100);
        throw new IllegalArgumentException("Corner location expected");
    }
View Full Code Here

//    }
//    return font;
    }

    public void drawAntialiasedTextCentered(Graphics2D g2, String text, int fontSize, Position pos, ImmutablePoint centerNoScaled, Color fgColor, Color bgColor) {
        ImmutablePoint center = centerNoScaled.scale(getSquareSize());
        drawAntialiasedTextCenteredNoScale(g2, text, fontSize, pos, center, fgColor, bgColor);
    }
View Full Code Here

            g2.setColor(source.active ? ACTIVE_PLAGUE : ERADICTED_PLAGUE);
            int x = sqSize-boxSize-sqSize/10;
            int y = sqSize/10;
            g2.fillRect(getOffsetX(source.pos)+x, getOffsetY(source.pos)+y, boxSize, boxSize);
            if (source.active) {
                ImmutablePoint center = new ImmutablePoint(x+boxSize/2, y+boxSize/2);
                drawAntialiasedTextCenteredNoScale(g2, i+"", 26, source.pos, center, Color.WHITE, null);
            }
        }
    }
View Full Code Here

TOP

Related Classes of com.jcloisterzone.ui.ImmutablePoint

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.