Editing disabled while running simulator
This commit is contained in:
@@ -52,6 +52,7 @@ public class ControlPanel extends JPanel
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
p.getT().start();
|
||||
p.setPlay(true);
|
||||
runningLabel.setText("Simulation Started");
|
||||
}
|
||||
});
|
||||
@@ -64,6 +65,7 @@ public class ControlPanel extends JPanel
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
p.getT().stop();
|
||||
p.setPlay(false);
|
||||
runningLabel.setText("Simulation Stopped");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -63,6 +63,7 @@ public class Panel extends JPanel implements ActionListener
|
||||
private Path currentPath;
|
||||
private static int width = 1920;
|
||||
private static int height = 1080;
|
||||
private boolean play = false;
|
||||
|
||||
Point2D cameraPoint = new Point2D.Double(getWidth() / 2, getHeight() / 2);
|
||||
float cameraScale = 1;
|
||||
@@ -666,6 +667,16 @@ public class Panel extends JPanel implements ActionListener
|
||||
{
|
||||
this.t = t;
|
||||
}
|
||||
|
||||
public void setPlay(boolean play)
|
||||
{
|
||||
this.play = play;
|
||||
}
|
||||
|
||||
public boolean getPlay()
|
||||
{
|
||||
return play;
|
||||
}
|
||||
|
||||
public void newWorld(int width, int height, int terrainIndex)
|
||||
{
|
||||
|
||||
@@ -34,6 +34,8 @@ public class Mouse extends MouseAdapter
|
||||
panel.setLastClickPosition(clickPoint);
|
||||
panel.setLastMousePosition(e.getPoint());
|
||||
|
||||
if(!panel.getPlay())
|
||||
{
|
||||
if (!panel.getClickedOption().equals("Path"))
|
||||
{
|
||||
if (e.getY() < 150)
|
||||
@@ -150,13 +152,14 @@ public class Mouse extends MouseAdapter
|
||||
|
||||
panel.getCurrentPath().addPoint(new Point2D.Double(clickPoint.getX(), clickPoint.getY()));
|
||||
|
||||
}
|
||||
}
|
||||
panel.repaint();
|
||||
}
|
||||
|
||||
public void mouseReleased(MouseEvent e)
|
||||
{
|
||||
if (panel.getDragObject() != null)
|
||||
if (panel.getDragObject() != null && !panel.getPlay())
|
||||
{
|
||||
if (panel.getDragObject().getRectangleColor() != Color.RED)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user