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);
}
}
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);
}
}
}
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);
}
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);
}
}
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());
}