-
Notifications
You must be signed in to change notification settings - Fork 2
/
GameWindow.pde
76 lines (60 loc) · 2.22 KB
/
GameWindow.pde
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
public class GameWindow implements Window {
private VScrollBar scrollBar;
private Component playByPlayBox;
private Game game;
private WindowHeader header;
public GameWindow(Game game) {
this.game = game;
this.header = new WindowHeader("Game: " + game.getDate() + " - " + game.getVisitorTeam().getAbbreviation()
+ " " + game.getVisitorScore() + " x " + game.getHomeScore() + " " + game.getHomeTeam().getAbbreviation());
}
public void setup() {
this.playByPlayBox = new PlayByPlayBox(980, 0, this.game);
this.playByPlayBox.setup();
this.scrollBar = new VScrollBar(20, WINDOW_HEIGHT-150, this.playByPlayBox.getHeight());
}
public void draw() {
background(COLOR_BEIGE3);
pushMatrix();
translate(WINDOW_WIDTH - scrollBar.getWidth()-50, 150);
scrollBar.update();
scrollBar.draw();
translate(-playByPlayBox.getWidth(), scrollBar.getPos());
playByPlayBox.draw();
popMatrix();
int scoreCenter = playByPlayBox.getWidth()/2;
pushMatrix();
translate(WINDOW_WIDTH-playByPlayBox.getWidth()-scrollBar.getWidth()-50, header.getHeight());
fill(COLOR_BEIGE2);
rect(0, 0, playByPlayBox.getWidth()+scrollBar.getWidth(), 100);
fill(COLOR_GRAY1);
textAlign(CENTER);
textFont(FONT_BOLD_28);
text("X", scoreCenter, 60);
textFont(FONT_16);
text(game.getDate(), scoreCenter, 90);
textFont(FONT_BOLD_36);
textAlign(RIGHT);
text(game.getVisitorScore(), scoreCenter - 20, 62);
textAlign(LEFT);
text(game.getHomeScore(), scoreCenter + 20, 62);
image(game.getVisitorTeam().getLogo(), scoreCenter - 445, 15, 80, 64);
image(game.getHomeTeam().getLogo(), scoreCenter + 445 - 80, 15, 80, 64);
textFont(FONT_BOLD_19);
textAlign(RIGHT);
text(game.getVisitorTeam().getName(), scoreCenter - 90, 56);
textAlign(LEFT);
text(game.getHomeTeam().getName(), scoreCenter + 90, 56);
popMatrix();
header.draw();
}
public void mouseEvent(int eventType) {
scrollBar.mouseEvent(eventType);
playByPlayBox.mouseEvent(eventType);
header.mouseEvent(eventType);
}
public void event(ControlEvent event) {
}
public void clearControls() {
}
}