Browse Source

Refactored Input forwarding to own function

remotes/origin/menu
fdai7012 11 months ago
parent
commit
5666fd6863
  1. 12
      src/main/java/pacmanGame/Program.java

12
src/main/java/pacmanGame/Program.java

@ -29,10 +29,7 @@ public class Program {
boolean running = true; boolean running = true;
while(running) { while(running) {
for (char inputChar : input.inputList) {
gameManager.ProcessInput(inputChar);
}
input.inputList.clear();
ForwardInputToGameManager();
gameManager.Update(); gameManager.Update();
@ -44,6 +41,13 @@ public class Program {
} }
} }
public void ForwardInputToGameManager() {
for (char inputChar : input.inputList) {
gameManager.ProcessInput(inputChar);
}
input.inputList.clear();
}
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);

Loading…
Cancel
Save