prepare for hand drawing with maze.
This commit is contained in:
@@ -634,6 +634,7 @@ public class Display extends JFrame
|
||||
final MazeCellParameters cp;
|
||||
Position current = null;
|
||||
LinkedList<DirectionPosition> solvedPath = null;
|
||||
LinkedList<DirectionPosition> drawingPath = null;
|
||||
final Object lockChange = new Object();
|
||||
// current postion of human resolving
|
||||
int sX = 0;
|
||||
@@ -650,7 +651,23 @@ public class Display extends JFrame
|
||||
// should find the cell ...
|
||||
int pX = (int) ((double) (e.getX() - cp.getOffsetX()) / cp.getWidth());
|
||||
int pY = (int) ((double) (e.getY() - cp.getOffsetY()) / cp.getHeight());
|
||||
System.out.println("Mouse dragged Cell [" + pX + ',' + pY + ']');
|
||||
Position newPosition = new Position(pX,pY);
|
||||
if (drawingPath == null )
|
||||
{
|
||||
drawingPath = new LinkedList<>();
|
||||
}
|
||||
else
|
||||
{
|
||||
DirectionPosition last = drawingPath.getLast();
|
||||
if ( last.getPosition().equals(newPosition))
|
||||
{
|
||||
// no move.
|
||||
return;
|
||||
}
|
||||
// short path=computeMove(last,newPosition);
|
||||
}
|
||||
System.out.println("Mouse dragged Cell " + newPosition);
|
||||
drawingPath.addLast(new DirectionPosition((short) 0,newPosition));
|
||||
map.noWalls(pX,pY);
|
||||
changed(null,null,map);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user