-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGameDriver.java
53 lines (45 loc) · 1.5 KB
/
GameDriver.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import java.awt.*;
/**
* Write a description of class GameDriver here.
*
* @author Sean Walsh
* @version 1.0
*/
public class GameDriver {
/**
* Main method to run project
*
* @param args[] Takes command line args
*/
public static void main(String args[]) {
ImgLib.ImageLibrary();
SoundLib.SoundLib();
JDialog menuDialog = new JDialog(
new JFrame("Ticket to Ride - Team 3 (2016) [MENU]"), true);
MenuPanel mp = new MenuPanel();
menuDialog.setSize(1276, 939); // set frame size
menuDialog.add(mp);
menuDialog.setVisible(true);
JFrame gameFrame = new JFrame("Ticket to Ride - Team 3 (2016)");
gameFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
gameFrame.setSize(1276, 989); // set frame size
//set app icon
Image image = new ImageIcon(ImgLib.appIcon).getImage();
gameFrame.setIconImage(image);
// creates new GamePanel, passing player list form the MenuPanel
GamePanel gp = new GamePanel(mp.players);
gameFrame.add(gp, BorderLayout.CENTER); // add panel to frame
gameFrame.setVisible(true); // display frame
gameFrame.addWindowListener(new WindowAdapter()
{
@Override
public void windowClosing(WindowEvent e)
{
SoundLib.background.stop();
}
});
}
}