| 39 | import GraphServer.Constants; |
| 40 | |
| 41 | public class GameScreen extends JPanel implements ActionListener, StartStopPanel, KeyListener, MouseListener |
| 42 | { |
| 43 | private Graphwar graphwar; |
| 44 | |
| 45 | private JLabel[] backgroundImages; |
| 46 | |
| 47 | private JLabel yImg; |
| 48 | private JLabel dyImg; |
| 49 | private JLabel ddyImg; |
| 50 | |
| 51 | private GraphButton fire; |
| 52 | private GraphButton quit; |
| 53 | private GraphButton global; |
| 54 | private JTextField funcField; |
| 55 | private JTextField chatField; |
| 56 | private GraphTextBox chatBox; |
| 57 | private GraphPlane plane; |
| 58 | private GraphTimer timer; |
| 59 | private GraphAngleDisplay angleDisplay; |
| 60 | |
| 61 | private JLabel[] backgroundsQuit; |
| 62 | private GraphButton yesQuit; |
| 63 | private GraphButton noQuit; |
| 64 | private boolean quitVisible; |
| 65 | |
| 66 | private JLabel[] backgroundsShowMessage; |
| 67 | private GraphButton okButton; |
| 68 | private JLabel messageLabel; |
| 69 | private boolean showMessageVisible; |
| 70 | |
| 71 | public GameScreen(Graphwar graphwar, String confFile) throws Exception |
| 72 | { |
| 73 | this.graphwar = graphwar; |
| 74 | |
| 75 | this.setLayout(null); |
| 76 | this.setBounds(0,0,Constants.WIDTH,Constants.HEIGHT); |
| 77 | |
| 78 | BufferedReader read = new BufferedReader(new InputStreamReader(graphwar.getClass().getResourceAsStream(confFile))); |
| 79 | |
| 80 | // Stack used to add components in reverse order, because swing draws components added first first |
| 81 | // and that is not intuitive to the way the data is read from the files |
| 82 | Stack<Component> components = new Stack<Component>(); |
| 83 | |
| 84 | ///// Main Screen ///////////// |
| 85 | |
| 86 | int numBackgroundImages = Integer.parseInt(GraphUtil.nextLine(read)); |
| 87 | backgroundImages = new JLabel[numBackgroundImages]; |
| 88 | |
| 89 | for(int i=0; i<numBackgroundImages; i++) |
| 90 | { |
| 91 | backgroundImages[i] = GraphUtil.makeBackgroundImage(graphwar, read); |
| 92 | components.push(backgroundImages[i]); |
| 93 | } |
| 94 | |
| 95 | yImg = GraphUtil.makeBackgroundImage(graphwar, read); |
| 96 | dyImg = GraphUtil.makeBackgroundImage(graphwar, read); |
| 97 | ddyImg = GraphUtil.makeBackgroundImage(graphwar, read); |
| 98 | fire = GraphUtil.makeButton(graphwar, read); |
nothing calls this directly
no outgoing calls
no test coverage detected