Package com.tinygo.gam

Examples of com.tinygo.gam.WIT


            oldWits = wits = null;
            oldWits = new WIT[zW][zH];
            wits = new WIT[zW][zH];
            for (int i = 0; i < zW; i++)
                for (int j = 0; j < zH; j++) {
                    oldWits[i][j] = new WIT();
                    wits[i][j] = new WIT();
                }

            zoomW = zW;
            zoomH = zH;
        }
View Full Code Here


        }

        // new stone configuration
        for (int x = zoomX; x < zoomX + zoomW; x++)
            for (int y = zoomY; y < zoomY + zoomH; y++) {
                WIT wit = getWit(x, y);
                wit.clear(WIT.CELL);
                if (setupCells)
                    wit.setCell(x, y, boardSize);
                byte color = game.board.get(x, y);
                if (color != Board.NONE)
                    wit.setStone(color == Board.BLACK);
            }

        if (setupCells) {
            final int[] hoshis = Board.getHoshis(boardSize);
            if (hoshis != null)
                for (int k = 0; k < hoshis.length; k++) {
                    SGFPoint sgfp = Board.xy(hoshis[k], boardSize);
                    if (isInView(sgfp))
                        getWit(sgfp).addMark(WIT.HOSHI);
                }
            setupCells = false;
        }

        SGFNode lastMoveNode = game.kifuLastMove();

        // draw marks from properties
        for (Enumeration e = lastMoveNode.getProperties(); e.hasMoreElements(); ) {
            SGFProperty prop = (SGFProperty) e.nextElement();
            try {
                SGFPoint sgfp = prop.getPoint();
                if (isInView(sgfp)) {
                    WIT wit = getWit(sgfp);
                    if (prop.name() == SGFPropertyName.TR)
                        wit.addMark(WIT.TRIANGLE);
                    else if (prop.name() == SGFPropertyName.SQ)
                        wit.addMark(WIT.SQUARE);
                    else if (prop.name() == SGFPropertyName.CR)
                        wit.addMark(WIT.CIRCLE);
                    else if (prop.name() == SGFPropertyName.MA)
                        wit.addMark(WIT.CROSS);
                    else if (prop.name() == SGFPropertyName.SL)
                        wit.addMark(WIT.SELECTED);
                    else if (prop.name() == SGFPropertyName.DD)
                        wit.addMark(WIT.DIMMED);
                    else if (prop.name() == SGFPropertyName.TW)
                        wit.addMark(WIT.WHITE_TER);
                    else if (prop.name() == SGFPropertyName.TB)
                        wit.addMark(WIT.BLACK_TER);
                    else if (prop.name() == SGFPropertyName.LB)
                        wit.setLabel(prop.getText());
                    else if (prop.name() == SGFPropertyName.VW)
                        wit.addMark(WIT.VIEW);
                }
            } catch (SGFInvalidDataRequestException e1) {
            }
        }
View Full Code Here

        serviceRepaints();
    }

    private boolean drawWIT(int x, int y) {
        final WIT wit = getWit(x, y);
        final WIT oldWit = getOldWit(x, y);

        if (wit.equals(oldWit))
            return false;

        int origBits, bits;
        origBits = bits = wit.bits;
        boolean incremental =
               (oldWit.bits & WIT.CELL) == (wit.bits & WIT.CELL// same cell type
            && ((oldWit.bits & WIT.PURE_MARK) == 0 || (wit.bits & WIT.SOLID) == 0)
            && (oldWit.bits & ~wit.bits) == 0             // no marks removed
            && (oldWit.bits & WIT.OVER_CELL) == 0          // no over-cell markup on screen (like dimmed)
            && oldWit.sameLabel(wit);                     // same label
        if (incremental)
            bits &= ~oldWit.bits;
        oldWit.set(wit);

        //#ifdef debug
        /*System.out.print("Draw " + x + "," + y + ": " + (incremental ? '+' : ' '));
        if ((bits & WIT.CELL) != 0)
            System.out.print(" CELL");
View Full Code Here

            oldWits = wits = null;
            oldWits = new WIT[zW][zH];
            wits = new WIT[zW][zH];
            for (int i = 0; i < zW; i++)
                for (int j = 0; j < zH; j++) {
                    oldWits[i][j] = new WIT();
                    wits[i][j] = new WIT();
                }

            zoomW = zW;
            zoomH = zH;
        }
View Full Code Here

        }

        // new stone configuration
        for (int x = zoomX; x < zoomX + zoomW; x++)
            for (int y = zoomY; y < zoomY + zoomH; y++) {
                WIT wit = getWit(x, y);
                wit.clear(WIT.CELL);
                if (setupCells)
                    wit.setCell(x, y, boardSize);
                byte color = game.board.get(x, y);
                if (color != Board.NONE)
                    wit.setStone(color == Board.BLACK);
            }

        if (setupCells) {
            final int[] hoshis = Board.getHoshis(boardSize);
            if (hoshis != null)
                for (int k = 0; k < hoshis.length; k++) {
                    SGFPoint sgfp = Board.xy(hoshis[k], boardSize);
                    if (isInView(sgfp))
                        getWit(sgfp).addMark(WIT.HOSHI);
                }
            setupCells = false;
        }

        SGFNode lastMoveNode = game.kifuLastMove();

        // draw marks from properties
        for (Enumeration e = lastMoveNode.getProperties(); e.hasMoreElements(); ) {
            SGFProperty prop = (SGFProperty) e.nextElement();
            try {
                SGFPoint sgfp = prop.getPoint();
                if (isInView(sgfp)) {
                    WIT wit = getWit(sgfp);
                    if (prop.name() == SGFPropertyName.TR)
                        wit.addMark(WIT.TRIANGLE);
                    else if (prop.name() == SGFPropertyName.SQ)
                        wit.addMark(WIT.SQUARE);
                    else if (prop.name() == SGFPropertyName.CR)
                        wit.addMark(WIT.CIRCLE);
                    else if (prop.name() == SGFPropertyName.MA)
                        wit.addMark(WIT.CROSS);
                    else if (prop.name() == SGFPropertyName.SL)
                        wit.addMark(WIT.SELECTED);
                    else if (prop.name() == SGFPropertyName.DD)
                        wit.addMark(WIT.DIMMED);
                    else if (prop.name() == SGFPropertyName.TW)
                        wit.addMark(WIT.WHITE_TER);
                    else if (prop.name() == SGFPropertyName.TB)
                        wit.addMark(WIT.BLACK_TER);
                    else if (prop.name() == SGFPropertyName.LB)
                        wit.setLabel(prop.getText());
                    else if (prop.name() == SGFPropertyName.VW)
                        wit.addMark(WIT.VIEW);
                }
            } catch (SGFInvalidDataRequestException e1) {
            }
        }
View Full Code Here

        serviceRepaints();
    }

    private boolean drawWIT(int x, int y) {
        final WIT wit = getWit(x, y);
        final WIT oldWit = getOldWit(x, y);

        if (wit.equals(oldWit))
            return false;

        int origBits, bits;
        origBits = bits = wit.bits;
        boolean incremental =
               (oldWit.bits & WIT.CELL) == (wit.bits & WIT.CELL// same cell type
            && ((oldWit.bits & WIT.PURE_MARK) == 0 || (wit.bits & WIT.SOLID) == 0)
            && (oldWit.bits & ~wit.bits) == 0             // no marks removed
            && (oldWit.bits & WIT.OVER_CELL) == 0          // no over-cell markup on screen (like dimmed)
            && oldWit.sameLabel(wit);                     // same label
        if (incremental)
            bits &= ~oldWit.bits;
        oldWit.set(wit);

        //#ifdef debug
        /*System.out.print("Draw " + x + "," + y + ": " + (incremental ? '+' : ' '));
        if ((bits & WIT.CELL) != 0)
            System.out.print(" CELL");
View Full Code Here

TOP

Related Classes of com.tinygo.gam.WIT

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.