fixed camera-bigger-than-canvas situation
This commit is contained in:
parent
16396b2323
commit
1cb9c72b32
@ -72,6 +72,14 @@ public class Camera {
|
|||||||
cameraOffsetY = (-1) * (CELL_SIZE * CANVAS_HEIGHT - CELL_SIZE * WINDOW_HEIGHT);
|
cameraOffsetY = (-1) * (CELL_SIZE * CANVAS_HEIGHT - CELL_SIZE * WINDOW_HEIGHT);
|
||||||
Ysize = 0;
|
Ysize = 0;
|
||||||
}
|
}
|
||||||
|
if (WINDOW_WIDTH > CANVAS_WIDTH) {
|
||||||
|
cameraOffsetX = (WINDOW_WIDTH - CANVAS_WIDTH) * CELL_SIZE / 2;
|
||||||
|
Xsize = 0;
|
||||||
|
}
|
||||||
|
if (WINDOW_HEIGHT > CANVAS_HEIGHT) {
|
||||||
|
cameraOffsetY = (WINDOW_HEIGHT - CANVAS_HEIGHT) * CELL_SIZE / 2;
|
||||||
|
Ysize = 0;
|
||||||
|
}
|
||||||
canvas.setLocation(cameraOffsetX + Xsize, cameraOffsetY + Ysize);
|
canvas.setLocation(cameraOffsetX + Xsize, cameraOffsetY + Ysize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -19,8 +19,8 @@ public class WindowOfFreeMove extends JFrame {
|
|||||||
public static final int CELL_SIZE = 40;
|
public static final int CELL_SIZE = 40;
|
||||||
public static int CANVAS_WIDTH = 50;
|
public static int CANVAS_WIDTH = 50;
|
||||||
public static int CANVAS_HEIGHT = 50;
|
public static int CANVAS_HEIGHT = 50;
|
||||||
public static final int WINDOW_WIDTH = 9;
|
public static final int WINDOW_WIDTH = 11;
|
||||||
public static final int WINDOW_HEIGHT = 9;
|
public static final int WINDOW_HEIGHT = 11;
|
||||||
|
|
||||||
private static boolean canPersonMove;
|
private static boolean canPersonMove;
|
||||||
private static int nextMove;
|
private static int nextMove;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user