Package com.barrybecker4.common.geometry

Examples of com.barrybecker4.common.geometry.Location


        for (final Player player : players) {
            for (Order order : ((GalacticPlayer) player).getOrders()) {

                int margin = getMargin();

                Location begin = order.getOrigin().getLocation();
                Point2D end = order.getCurrentLocation();

                g2.setColor(order.getOwner().getColor());
                int beginX = (int) (margin + cellSize * (begin.getCol() - 0.5));
                int beginY = (int) (margin + cellSize * begin.getRow() - 0.5);
                int endX = (int) (margin + cellSize * (end.getX() - 0.5));
                int endY = (int) (margin + cellSize * (end.getY() - 0.5));

                g2.drawLine(beginX, beginY, endX, endY);

View Full Code Here


    /**
     * @return the tooltip for the panel given a mouse event
     */
    @Override
    public String getToolTipText( MouseEvent e ) {
        Location loc = getBoardRenderer().createLocation(e);
        StringBuilder sb = new StringBuilder( "<html><font=-3>" );

        BoardPosition space = ((IRectangularBoard)controller_.getBoard()).getPosition( loc );
        if ( space != null && space.isOccupied() && GameContext.getDebugMode() >= 0 ) {
            sb.append(((Planet)space.getPiece()).toHtml());
View Full Code Here

    public void mousePressed( MouseEvent e ) {
        CheckersController controller = (CheckersController)viewer_.getController();

        if (controller.isProcessing())
            return;
        Location loc = getRenderer().createLocation(e);

        Board board = (Board)controller.getBoard();
        BoardPosition position = board.getPosition( loc );
        // if there is no piece or out of bounds, then return without doing anything
        if ( (position == null) || (position.isUnoccupied()) ) {
View Full Code Here

    public void mouseReleased( MouseEvent e ) {
        CheckersBoardViewer viewer = (CheckersBoardViewer)viewer_;
        CheckersController controller = (CheckersController)viewer.getController();

        // compute the coordinates of the position that we dropped the piece on.
        Location loc = getRenderer().createLocation(e);

        if ( getRenderer().getDraggedPiece() == null )
            return; // nothing being dragged

        Board board = (Board)controller.getBoard();
View Full Code Here

    /**
     *   implements the MouseMotionListener interface
     */
    @Override
    public void mouseDragged( MouseEvent e ) {
        Location loc = getRenderer().createLocation(e);

        if ( getRenderer().getDraggedShowPiece() != null ) {
            getRenderer().getDraggedShowPiece().setLocation( loc );
        }
        viewer_.repaint(); viewer_.refresh();
View Full Code Here

     * @return the tooltip for the panel given a mouse event
     */
    @Override
    public String getToolTipText( MouseEvent e ) {

        Location loc = getBoardRenderer().createLocation(e);
        StringBuilder sb = new StringBuilder( "<html><font=-3>" );

        BoardPosition space = ((IRectangularBoard) controller_.getBoard()).getPosition( loc );
        if ( space != null && space.isOccupied() && GameContext.getDebugMode() > 0 ) {
            sb.append( loc );
View Full Code Here

    public UserEnteredValues getUserEnteredValues() {
        return userEnteredValues;
    }

    public void mouseClicked(MouseEvent e) {
        Location location = locator.getCellCoordinates(e.getPoint());
        setCurrentLocation(location);
    }
View Full Code Here

        return keyCode >= KeyEvent.VK_LEFT && keyCode <= KeyEvent.VK_DOWN
               || keyCode >= KeyEvent.VK_KP_UP && keyCode <= KeyEvent.VK_KP_DOWN;
    }

    private void handleArrowKey(int keyCode) {
        Location location = null;
        switch (keyCode) {
            case KeyEvent.VK_LEFT :
            case KeyEvent.VK_KP_LEFT : location = currentCellLocation.incrementOnCopy(0, -1);
                break;
            case KeyEvent.VK_RIGHT :
View Full Code Here

        if (tiles_.size() == 1) {
            return 1.0;
        }
        TilePlacement first = getFirst();
        TilePlacement last = getLast();
        Location end1 = first.getLocation();
        Location end2 = last.getLocation();

        // if they touch return distance of 0
        if (first.getOutgoingPathLocations(primaryPathColor_).containsValue(end2)
                && last.getOutgoingPathLocations(primaryPathColor_).containsValue(end1)) {
            return 0;
View Full Code Here

        List<Location> emptyNbrLocations = new LinkedList<Location>();
        Box bbox = tantrix.getBoundingBox();

        for (byte i=0; i< NUM_SIDES; i++) {

            Location nbrLoc = HexUtil.getNeighborLocation(loc, i);
            if (tantrix.get(nbrLoc) == null && bbox.contains(nbrLoc)) {
                emptyNbrLocations.add(nbrLoc);
            }
        }
        return emptyNbrLocations;
View Full Code Here

TOP

Related Classes of com.barrybecker4.common.geometry.Location

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.