Fix with rendering and showing Map (buged)

This commit is contained in:
iryupnik 2020-03-03 22:11:01 +01:00
parent 8898695506
commit 606c53e89c
2 changed files with 10 additions and 9 deletions

View File

@ -37,6 +37,7 @@ public class EventMoveToCell extends Cell {
WindowOfFreeMove.setMap(this.map);
WindowOfFreeMove.getMap().setIdExit(id);
WindowOfFreeMove.paintMapOnWindow();
WindowOfFreeMove.repaintCanvas();
}
@Override

View File

@ -19,7 +19,7 @@ public class WindowOfFreeMove extends JFrame {
static final int KEY_RIGHT = 39;
static final int KEY_DOWN = 40;
private Canvas canvas;
private static Canvas canvas;
private static JPanel dialogBar;
private JLayeredPane lp;
private static Map map;
@ -30,6 +30,10 @@ public class WindowOfFreeMove extends JFrame {
return map;
}
public static void repaintCanvas(){
canvas.repaint();
}
public static JPanel getDialogBar() {
return dialogBar;
}
@ -67,7 +71,7 @@ public class WindowOfFreeMove extends JFrame {
dialogBar.setBackground(Color.BLACK);
dialogBar.setVisible(false);
inputTimer = new Timer(17, new ActionListener() {
inputTimer = new Timer(13, new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
if (!map.getPerson().getIsMoving()) {
@ -117,11 +121,6 @@ public class WindowOfFreeMove extends JFrame {
}
public Canvas getCanvas() {
return canvas;
}
public void start() {
Rectangle[] rec = new Rectangle[12];
int count = 0;
@ -155,12 +154,13 @@ public class WindowOfFreeMove extends JFrame {
m3.addMoveToEvent(new EventMoveToCell(3, 1, 8, 8, m4));
m3.addMoveToEvent(new EventMoveToCell(2, 3, 8, 1, m2));
m4.addMoveToEvent(new EventMoveToCell(4, 1, 9, 9, m1));
m4.addMoveToEvent(new EventMoveToCell(3, 3, 9, 1, m3));
m4.addMoveToEvent(new EventMoveToCell(4, 1, 8, 8, m1));
m4.addMoveToEvent(new EventMoveToCell(3, 3, 8, 1, m3));
setMap(m1);
map.createMap();
isReadyToPaint = true;
canvas.repaint();
//
// lp.remove(dialogBar);
//