|
@ -17,24 +17,17 @@ public class Program { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void StartGame() { |
|
|
public void StartGame() { |
|
|
|
|
|
|
|
|
CreateAndShowGUI(); |
|
|
CreateAndShowGUI(); |
|
|
gameManager = new GameManager(); |
|
|
gameManager = new GameManager(); |
|
|
|
|
|
|
|
|
GameLoop(); |
|
|
GameLoop(); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void GameLoop() { |
|
|
public void GameLoop() { |
|
|
boolean running = true; |
|
|
boolean running = true; |
|
|
|
|
|
|
|
|
while(running) { |
|
|
while(running) { |
|
|
ForwardInputToGameManager(); |
|
|
ForwardInputToGameManager(); |
|
|
|
|
|
|
|
|
gameManager.Update(); |
|
|
gameManager.Update(); |
|
|
|
|
|
|
|
|
textArea.setText((String)gameManager.visualizer.GetOutput()); |
|
|
textArea.setText((String)gameManager.visualizer.GetOutput()); |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
Thread.sleep(100); |
|
|
Thread.sleep(100); |
|
|
} catch (InterruptedException e) {} |
|
|
} catch (InterruptedException e) {} |
|
@ -53,22 +46,17 @@ public class Program { |
|
|
public void CreateAndShowGUI() { |
|
|
public void CreateAndShowGUI() { |
|
|
frame = new JFrame("PacmaaaAAAYYYHAAAaaam"); |
|
|
frame = new JFrame("PacmaaaAAAYYYHAAAaaam"); |
|
|
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|
|
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
|
|
|
|
|
|
|
|
frame.setSize(750, 950); |
|
|
frame.setSize(750, 950); |
|
|
|
|
|
|
|
|
textArea = new JTextArea("..."); |
|
|
textArea = new JTextArea("..."); |
|
|
textArea.setEditable(false); |
|
|
textArea.setEditable(false); |
|
|
textArea.setFocusable(false); |
|
|
textArea.setFocusable(false); |
|
|
textArea.setBackground(Color.black); |
|
|
textArea.setBackground(Color.black); |
|
|
textArea.setForeground(Color.yellow); |
|
|
textArea.setForeground(Color.yellow); |
|
|
|
|
|
|
|
|
Font font = new Font("Consolas", Font.PLAIN, 10); |
|
|
Font font = new Font("Consolas", Font.PLAIN, 10); |
|
|
textArea.setFont(font); |
|
|
textArea.setFont(font); |
|
|
|
|
|
|
|
|
frame.add(textArea, BorderLayout.CENTER); |
|
|
frame.add(textArea, BorderLayout.CENTER); |
|
|
frame.setLocationRelativeTo(null); |
|
|
frame.setLocationRelativeTo(null); |
|
|
frame.setVisible(true); |
|
|
frame.setVisible(true); |
|
|
|
|
|
|
|
|
input = new MyKeyListener(); |
|
|
input = new MyKeyListener(); |
|
|
frame.addKeyListener(input); |
|
|
frame.addKeyListener(input); |
|
|
} |
|
|
} |
|
|