Same functionality as the other initialization method. The only difference is that the xOff and yOff parameters will change where the renderFrame method starts drawing. For example, if you select w = 60, h = 30, xOff = 3, yOff = 4 and then call renderFrame with a TETile[50][25] array, the renderer w
(int w, int h, int xOff, int yOff)
| 28 | * @param h height of the window in tiles. |
| 29 | */ |
| 30 | public void initialize(int w, int h, int xOff, int yOff) { |
| 31 | this.width = w; |
| 32 | this.height = h; |
| 33 | this.xOffset = xOff; |
| 34 | this.yOffset = yOff; |
| 35 | StdDraw.setCanvasSize(width * TILE_SIZE, height * TILE_SIZE); |
| 36 | Font font = new Font("Monaco", Font.BOLD, TILE_SIZE - 2); |
| 37 | StdDraw.setFont(font); |
| 38 | StdDraw.setXscale(0, width); |
| 39 | StdDraw.setYscale(0, height); |
| 40 | |
| 41 | StdDraw.clear(new Color(0, 0, 0)); |
| 42 | |
| 43 | StdDraw.enableDoubleBuffering(); |
| 44 | StdDraw.show(); |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Initializes StdDraw parameters and launches the StdDraw window. w and h are the |