Browse Source

Added GameLoop Function to Program

remotes/origin/menu
fdai7012 11 months ago
committed by Julian
parent
commit
ef5dc961c4
  1. 17
      src/main/java/pacmanGame/Program.java

17
src/main/java/pacmanGame/Program.java

@ -6,6 +6,7 @@ import javax.swing.*;
public class Program { public class Program {
public GameManager gameManager;
public MyKeyListener input; public MyKeyListener input;
public JTextArea textArea; public JTextArea textArea;
public JFrame frame; public JFrame frame;
@ -18,9 +19,25 @@ public class Program {
public void StartGame() { public void StartGame() {
CreateAndShowGUI(); CreateAndShowGUI();
gameManager = new GameManager();
GameLoop();
} }
public void GameLoop() {
boolean running = true;
while(running) {
gameManager.Update();
textArea.setText((String)gameManager.visualizer.GetOutput());
try {
Thread.sleep(100);
} catch (InterruptedException e) {}
}
}
public void CreateAndShowGUI() { public void CreateAndShowGUI() {
frame = new JFrame("PacmaaaAAAYYYHAAAaaam"); frame = new JFrame("PacmaaaAAAYYYHAAAaaam");

Loading…
Cancel
Save