refactor Boot.java to streamline game initialization and window generation
This commit is contained in:
@@ -7,14 +7,21 @@ public class Boot {
|
|||||||
|
|
||||||
public static final Logger logger = Logger.getLogger("JDGame2D");
|
public static final Logger logger = Logger.getLogger("JDGame2D");
|
||||||
public static JFrame window;
|
public static JFrame window;
|
||||||
|
public static GamePanel gamePanel = new GamePanel();
|
||||||
|
|
||||||
static void main() {
|
static void main() {
|
||||||
|
generateWindow();
|
||||||
|
|
||||||
|
gamePanel.setupGame();
|
||||||
|
gamePanel.startGameThread();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void generateWindow() {
|
||||||
window = new JFrame();
|
window = new JFrame();
|
||||||
window.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
window.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||||
window.setResizable(false);
|
window.setResizable(false);
|
||||||
window.setTitle("JGame2D");
|
window.setTitle("JGame2D");
|
||||||
|
|
||||||
GamePanel gamePanel = new GamePanel();
|
|
||||||
window.add(gamePanel);
|
window.add(gamePanel);
|
||||||
|
|
||||||
gamePanel.config.load();
|
gamePanel.config.load();
|
||||||
@@ -24,9 +31,6 @@ public class Boot {
|
|||||||
|
|
||||||
window.setLocationRelativeTo(null);
|
window.setLocationRelativeTo(null);
|
||||||
window.setVisible(true);
|
window.setVisible(true);
|
||||||
|
|
||||||
gamePanel.setupGame();
|
|
||||||
gamePanel.startGameThread();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user