Search in sources :

Example 6 with Rectangle

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

the class AllFigGenerator 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 7 with Rectangle

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

the class FieldOnlyFigGenerator 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 8 with Rectangle

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

the class FieldOnlyFigGenerator 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 9 with Rectangle

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

the class NoHoldFigGenerator 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 10 with Rectangle

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

the class NoHoldFigGenerator 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)

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