g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
LinkedList<DropableFigure> blocks = mechanics.getBlocks();
Ball ball = mechanics.getBall();
double xE = getWidth() / mechanics.getWidth();
double yE = getHeight() / mechanics.getHeight();
for (MovableFigure block : blocks) {
double x = Math.round(block.getxPos() * xE);
double y = block.getyPos() * yE;
if (block instanceof Block) {
g2D.setColor(Color.CYAN);
g2D.fill(new Rectangle2D.Double(x, y, xE, yE));
}
if (block instanceof Special) {
g2D.setColor(Color.PINK);
g2D.fill(new RoundRectangle2D.Double(x, y, xE, yE, xE / 10, yE / 2));
}
}
g2D.setColor(color);
g2D.fill(new Ellipse2D.Double(ball.getxPos() * xE, ball.getyPos() * yE, xE, yE));
if(laser){
g2D.setColor(Color.ORANGE);
g2D.fillRoundRect(
(int) (ball.getxPos() * xE + xE / 2 - 5 ),
0,
10,
(int) (yE * (mechanics.getHeight() - 1)), 5, 40);
laser = false;
}