Search in sources :

Example 1 with Rectangle

use of util.fig.Rectangle in project solution-finder by knewjade.

the class AllFigGenerator method updateNext.

@Override
public void updateNext(List<Piece> pieces) {
    Color color = new Color(0x999999);
    int nextBoxCount = setting.geNextBoxCount() < pieces.size() ? setting.geNextBoxCount() : pieces.size();
    assert nextBoxCount <= pieces.size();
    for (int index = 0; index < nextBoxCount; index++) {
        Rectangle rectangle = positionDecider.getNext(index);
        graphics.setColor(FigColor.Background.getNormalColor());
        fillRect(rectangle);
        graphics.setColor(color);
        graphics.setStroke(new BasicStroke(2.0f));
        drawRoundRect(rectangle, 2);
        drawMino(pieces.get(index), rectangle);
    }
}
Also used : FigColor(util.fig.FigColor) Rectangle(util.fig.Rectangle)

Example 2 with Rectangle

use of util.fig.Rectangle in project solution-finder by knewjade.

the class AllFigGenerator method updateField.

@Override
public void updateField(ColoredField field, Mino mino, int x, int y) {
    ColoredField freeze = field.freeze(field.getMaxHeight());
    if (mino != null)
        freeze.putMino(mino, x, y);
    int heightBlock = setting.getFieldHeightBlock();
    int widthBlock = setting.getFieldWidthBlock();
    for (int yIndex = 0; yIndex < heightBlock; yIndex++) {
        boolean isFilledLine = freeze.isFilledLine(yIndex);
        for (int xIndex = 0; xIndex < widthBlock; xIndex++) {
            ColorType type = field.getColorType(xIndex, yIndex);
            FigColor figColor = FigColor.parse(type);
            Color color = getColor(figColor, isFilledLine);
            graphics.setColor(color);
            Rectangle rectangle = positionDecider.getInField(xIndex, yIndex);
            fillRect(rectangle);
        }
    }
}
Also used : ColoredField(common.tetfu.field.ColoredField) FigColor(util.fig.FigColor) FigColor(util.fig.FigColor) Rectangle(util.fig.Rectangle) ColorType(common.tetfu.common.ColorType)

Example 3 with Rectangle

use of util.fig.Rectangle in project solution-finder by knewjade.

the class AllFigGenerator method updateHold.

@Override
public void updateHold(Piece piece) {
    Color color = new Color(0xdddddd);
    Rectangle rectangle = positionDecider.getHold();
    graphics.setColor(FigColor.Background.getNormalColor());
    fillRect(rectangle);
    graphics.setColor(color);
    graphics.setStroke(new BasicStroke(2.0f));
    drawRoundRect(rectangle, 0);
    drawMino(piece, rectangle);
}
Also used : FigColor(util.fig.FigColor) Rectangle(util.fig.Rectangle)

Example 4 with Rectangle

use of util.fig.Rectangle in project solution-finder by knewjade.

the class NoHoldFigGenerator method updateMino.

@Override
public void updateMino(ColorType colorType, Rotate rotate, int xIndex, int yIndex) {
    Piece piece = colorConverter.parseToBlock(colorType);
    Mino mino = minoFactory.create(piece, rotate);
    FigColor figColor = FigColor.parse(colorType);
    Color color = figColor.getStrongColor();
    graphics.setColor(color);
    for (int[] positions : mino.getPositions()) {
        Rectangle rectangle = positionDecider.getInField(xIndex + positions[0], yIndex + positions[1]);
        fillRect(rectangle);
    }
}
Also used : Piece(core.mino.Piece) FigColor(util.fig.FigColor) FigColor(util.fig.FigColor) Rectangle(util.fig.Rectangle) Mino(core.mino.Mino)

Example 5 with Rectangle

use of util.fig.Rectangle in project solution-finder by knewjade.

the class BasicPositionDecider method getInField.

@Override
public Rectangle getInField(int xIndex, int yIndex) {
    Rectangle rectangle = fieldPositionDecider.getInField(xIndex, yIndex);
    if (rectangle == DUMMY)
        return DUMMY;
    int leftMargin = getHoldLeftMargin();
    return new Rectangle(rectangle.getX() + leftMargin, rectangle.getY(), rectangle.getWidth(), rectangle.getHeight());
}
Also used : Rectangle(util.fig.Rectangle)

Aggregations

Rectangle (util.fig.Rectangle)10 FigColor (util.fig.FigColor)9 ColorType (common.tetfu.common.ColorType)3 ColoredField (common.tetfu.field.ColoredField)3 Mino (core.mino.Mino)3 Piece (core.mino.Piece)3