Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
TowerDefense/src/Main.java
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
65 lines (53 sloc)
1.48 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.*; | |
import javax.swing.*; | |
public class Main extends JFrame{ | |
private static int[][] nodes; | |
private static final int NUM = 6; | |
public static void main(String[] args) { | |
JFrame frame = new JFrame("Tower Defense Refactor Mock GUI"); | |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
setupDefaultNodes(); | |
JPanel container = new JPanel(); | |
//container.setLayout(new BoxLayout(container, BoxLayout.X_AXIS)); | |
container.setLayout(new BorderLayout(10,10)); | |
MockGui mg = new MockGui(640,640,32, NUM, nodes); | |
StatGui sg= new StatGui(0,0); | |
//sg.setPreferredSize(new Dimension(1, 0)); //this keeps statgui from overlapping mockgui | |
//container.add(mg); | |
//container.add(sg); | |
container.add(mg, BorderLayout.CENTER); | |
container.add(sg, BorderLayout.SOUTH); | |
MapTowerDefense map = new MapTowerDefense(100, NUM, nodes, mg, sg); | |
mg.setMap(map); | |
sg.setMap(map); | |
sg.setup(); | |
frame.add(container); | |
frame.pack(); | |
frame.setSize(650,720); | |
frame.setVisible(true); | |
map.createMinion(MinionTypes.BASIC); | |
mg.step(); | |
} | |
private static void setupDefaultNodes() | |
{ | |
nodes = new int[NUM][2]; | |
nodes[0][0] = 1; | |
nodes[0][1] = 3; | |
nodes[1][0] = 16; | |
nodes[1][1] = 3; | |
nodes[2][0] = 16; | |
nodes[2][1] = 9; | |
nodes[3][0] = 4; | |
nodes[3][1] = 9; | |
nodes[4][0] = 4; | |
nodes[4][1] = 15; | |
nodes[5][0] = 18; | |
nodes[5][1] = 15; | |
/*nodes[6][0] = 18; | |
nodes[6][1] = 13; | |
nodes[7][0] = 11; | |
nodes[7][1] = 13; | |
nodes[8][0] = 11; | |
nodes[8][1] = 1;*/ | |
} | |
} |