Принятая лабораторная
This commit is contained in:
parent
33ef22cccc
commit
92be17d6f6
@ -1,5 +1,4 @@
|
||||
public enum Direction {
|
||||
|
||||
Up,
|
||||
Down,
|
||||
Left,
|
||||
|
@ -120,15 +120,10 @@ public class DrawningBattleship {
|
||||
g.setColor(Color.BLACK);
|
||||
|
||||
//Корпус корабля
|
||||
//Brush br = new SolidBrush(Battleship?.BodyColor ?? Color.Black);
|
||||
// Polygon[] shipHullArrayPoints = {((int)_startPosX, (int)_startPosY)), (int)_startPosX, (int)_startPosY + 50), new Point((int)_startPosX + 80, (int)_startPosY + 50),
|
||||
//(int)_startPosX + 120, (int)_startPosY + 25 ), new Point((int)_startPosX + 80, (int)_startPosY), new Point((int)_startPosX, (int)_startPosY)};
|
||||
g.setColor(Battleship.bodyColor);
|
||||
g.fillPolygon(new int[]{(int) _startPosX, (int) _startPosX , (int) _startPosX+80, (int) _startPosX + 120, (int)_startPosX + 80, (int)_startPosX},
|
||||
new int[]{(int) _startPosY, (int) _startPosY+50 , (int) _startPosY+50, (int) _startPosY + 25, (int)_startPosY, (int)_startPosY}, 6);
|
||||
|
||||
//Пушка
|
||||
|
||||
g.setColor(Color.BLACK);
|
||||
g.drawRect((int)_startPosX + 20, (int)_startPosY + 20, 30, 10);
|
||||
g.drawRect((int)_startPosX + 50,(int) _startPosY + 10, 20, 30);
|
||||
@ -150,8 +145,6 @@ public class DrawningBattleship {
|
||||
/// </summary>
|
||||
/// <param name="width">Ширина картинки</param>
|
||||
/// <param name="height">Высота картинки</param>
|
||||
|
||||
|
||||
public void ChangeBorders(int width, int height)
|
||||
{
|
||||
_pictureWidth = width;
|
||||
@ -171,5 +164,4 @@ public class DrawningBattleship {
|
||||
_startPosY = _pictureHeight - _battleshipHeight;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,8 +12,6 @@ public class DrawningBlocks {
|
||||
else {
|
||||
blocksCount = DirectionBlocksOnDeck.Two;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public void Init(int blocksCount, Color color)
|
||||
{
|
||||
@ -36,7 +34,6 @@ public class DrawningBlocks {
|
||||
g.fillRect(x + 38, y + 35, 10, 5);
|
||||
g.fillRect(x + 26, y + 35, 10, 5);
|
||||
g.fillRect(x + 14, y + 35, 10, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import java.awt.event.ActionListener;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.ComponentListener;
|
||||
import java.util.Random;
|
||||
|
||||
public class FormBattleship extends JComponent {
|
||||
private DrawningBattleship _battleship;
|
||||
private EntityBattleship _entityBattleship;
|
||||
@ -27,20 +26,16 @@ public class FormBattleship extends JComponent {
|
||||
|
||||
@Override
|
||||
public void componentMoved(ComponentEvent e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentShown(ComponentEvent e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentHidden(ComponentEvent e) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
Panel statusPanel = new Panel();
|
||||
statusPanel.setBackground(Color.WHITE);
|
||||
statusPanel.setLayout(new FlowLayout());
|
||||
@ -65,10 +60,8 @@ public class FormBattleship extends JComponent {
|
||||
weightLabel.setText("Вес: " + (int)_battleship.Battleship.GetWeight());
|
||||
colorLabel.setText("Цвет: " + _battleship.Battleship.GetBodyColor().getRed() + " " +
|
||||
_battleship.Battleship.GetBodyColor().getGreen() + " " + _battleship.Battleship.GetBodyColor().getBlue() );
|
||||
|
||||
repaint();
|
||||
|
||||
|
||||
});
|
||||
statusPanel.add(createButton);
|
||||
statusPanel.add(speedLabel);
|
||||
@ -101,7 +94,6 @@ public class FormBattleship extends JComponent {
|
||||
repaint();
|
||||
});
|
||||
|
||||
|
||||
statusPanel.add(leftButton);
|
||||
statusPanel.add(upButton);
|
||||
statusPanel.add(rightButton);
|
||||
|
Loading…
Reference in New Issue
Block a user