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 JFrame window;
|
||||
public static GamePanel gamePanel = new GamePanel();
|
||||
|
||||
static void main() {
|
||||
generateWindow();
|
||||
|
||||
gamePanel.setupGame();
|
||||
gamePanel.startGameThread();
|
||||
}
|
||||
|
||||
public static void generateWindow() {
|
||||
window = new JFrame();
|
||||
window.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
window.setResizable(false);
|
||||
window.setTitle("JGame2D");
|
||||
|
||||
GamePanel gamePanel = new GamePanel();
|
||||
window.add(gamePanel);
|
||||
|
||||
gamePanel.config.load();
|
||||
@@ -24,9 +31,6 @@ public class Boot {
|
||||
|
||||
window.setLocationRelativeTo(null);
|
||||
window.setVisible(true);
|
||||
|
||||
gamePanel.setupGame();
|
||||
gamePanel.startGameThread();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user