-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQuadTreeRunner.java
44 lines (36 loc) · 1.2 KB
/
QuadTreeRunner.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
package quadtree;
import com.revivedstandards.main.StandardDraw;
import com.revivedstandards.main.StandardGame;
import java.awt.Rectangle;
/**
* This class is the driver class for initializing the first QuadTree so its
* children are recursively constructed as points are added.
*
* @author Joshua Crotts
* @date 4/5/2020
*/
public class QuadTreeRunner extends StandardGame {
private final QuadTree quadTree;
private final PointAdder pointAdder;
private static final int WINDOW_WIDTH = 800;
private static final int WINDOW_HEIGHT = 800;
public QuadTreeRunner() {
super(WINDOW_WIDTH, WINDOW_HEIGHT, "QuadTree");
this.quadTree = new QuadTree(1, new Rectangle(0, 0, this.getGameWidth(), this.getGameHeight()));
this.pointAdder = new PointAdder(quadTree);
super.addMouseListener(this.pointAdder);
super.addMouseMotionListener(this.pointAdder);
this.startGame();
}
@Override
public void tick() {
this.quadTree.tick();
}
@Override
public void render() {
this.quadTree.render(StandardDraw.Renderer);
}
public static void main(String[] args) {
QuadTreeRunner tree = new QuadTreeRunner();
}
}