Pibd-23_Zhelovanov_D.Y._Bat.../DrawningRoundBlocks.java

49 lines
1.3 KiB
Java

import java.awt.*;
public class DrawningRoundBlocks implements IDrawningBlocks{
private DirectionBlocksOnDeck blocksOnDeck = DirectionBlocksOnDeck.Two;
@Override
public void DrawBlocks(Graphics g, int x, int y, Color bodyColor) {
g.setColor(Color.black);
switch(blocksOnDeck){
case Four -> {
g.fillOval(x + 56, y , 8, 8);
g.fillOval(x + 68, y , 8, 8);
g.fillOval(x + 68, y +40, 8, 8);
g.fillOval(x + 56, y + 40, 8, 8);
}
case Six -> {
g.fillOval(x + 54, y , 8, 8);
g.fillOval(x + 66, y , 8, 8);
g.fillOval(x + 78, y , 8, 8);
g.fillOval(x + 78, y + 40, 8, 8);
g.fillOval(x + 66, y + 40, 8, 8);
g.fillOval(x + 54, y + 40, 8, 8);
}}
}
@Override
public void SetBlocks(int count) {
switch(count)
{
case 2:
blocksOnDeck = DirectionBlocksOnDeck.Two;
break;
case 4:
blocksOnDeck = DirectionBlocksOnDeck.Four;
break;
case 6:
blocksOnDeck = DirectionBlocksOnDeck.Six;
break;
default:
break;
}
}
public DrawningRoundBlocks (int num) {
SetBlocks(num);
}
}