|
|
@ -1,5 +1,24 @@ |
|
|
|
package Snake; |
|
|
|
|
|
|
|
public class Game { |
|
|
|
public Game() { |
|
|
|
|
|
|
|
final int VIEW_SIZE = 100; |
|
|
|
final int GRID_SIZE = 10; |
|
|
|
final int CELL_SIZE = VIEW_SIZE / GRID_SIZE; |
|
|
|
|
|
|
|
Window gameWindow = new Window(VIEW_SIZE, GRID_SIZE); |
|
|
|
|
|
|
|
Snake snakeModel = new Snake(GRID_SIZE); |
|
|
|
SnakeView snakeView = new SnakeView(CELL_SIZE); |
|
|
|
|
|
|
|
Apple appleModel = new Apple(); |
|
|
|
AppleView appleView = new AppleView(CELL_SIZE); |
|
|
|
|
|
|
|
GameView gameView = gameWindow.getGameView(); |
|
|
|
gameView.addView(snakeView); |
|
|
|
gameView.addView(appleView); |
|
|
|
|
|
|
|
new Controller(gameWindow, snakeModel, snakeView, appleModel, appleView); |
|
|
|
} |
|
|
|
} |