parent
57bf0dedb1
commit
33b5cca9dd
@ -0,0 +1,23 @@
|
|||||||
|
package com.snakegame;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
|
||||||
|
public class GameWindow {
|
||||||
|
private final JFrame frame;
|
||||||
|
private final GamePanel gamePanel;
|
||||||
|
|
||||||
|
public GameWindow(GameConfig config, SoundManager soundManager) {
|
||||||
|
frame = new JFrame("贪吃蛇大作战");
|
||||||
|
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
gamePanel = new GamePanel(config, soundManager);
|
||||||
|
frame.add(gamePanel);
|
||||||
|
frame.pack();
|
||||||
|
frame.setLocationRelativeTo(null);
|
||||||
|
frame.setResizable(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void start() {
|
||||||
|
frame.setVisible(true);
|
||||||
|
gamePanel.getGameController().start();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue