-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTangibleGame.java
More file actions
109 lines (54 loc) · 2.51 KB
/
TangibleGame.java
File metadata and controls
109 lines (54 loc) · 2.51 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import processing.core.PApplet;
import processing.video.Movie;
import Game.GameInfo;
import Game.GameManager;
import Game.Shapes.Ball;
import Game.Shapes.Plate;
import Game.Shapes.ShapeSpace;
import Game.Utils;
import Game.Utils.Mode;
import Game.Utils.Score;
import ImageDetection.BoardDetection;
public class TangibleGame extends PApplet {
private static final long serialVersionUID = 1L;
Mode mode = new Mode();
Score score = new Score();
Plate plate = new Plate(Utils.PLATE_WIDTH, Utils.PLATE_HEIGHT, Utils.PLATE_DEPTH);
ShapeSpace shapeSpace = new ShapeSpace(Utils.SCENE_CENTER, plate, score);
Ball ball = new Ball(Utils.BALL_RADIUS);
GameManager manager;
GameInfo gameInfo;
Movie movie;
BoardDetection boardDetection;
@Override
public void setup() {
size(Utils.WINDOW_WIDTH, Utils.WINDOW_HEIGHT, P3D);
noStroke();
manager = new GameManager(shapeSpace, ball, this, mode );
gameInfo = new GameInfo(this, shapeSpace, ball, score);
boardDetection = new BoardDetection(this);
movie = new Movie(this, "data/testvideo.mp4");
movie.loop();
gameInfo.background.makeImg();
}
public void draw() {
// ambiance
background(230,230,230);
lights();
// game
boardDetection.updateAnglesIfDetected(movie);
manager.rotatedDraw( boardDetection.rotX() , boardDetection.rotZ() );
// info
gameInfo.barChartInfo.makeImg();
gameInfo.plateInfo.makeImg();
gameInfo.scoreInfo.makeImg();
image( gameInfo.background.getGraphics(), gameInfo.background.position().x, gameInfo.background.position().y );
image( gameInfo.barChartInfo.getGraphics(), gameInfo.barChartInfo.position().x, gameInfo.barChartInfo.position().y );
image( gameInfo.plateInfo.getGraphics(), gameInfo.plateInfo.position().x, gameInfo.plateInfo.position().y );
image( gameInfo.scoreInfo.getGraphics(), gameInfo.scoreInfo.position().x, gameInfo.scoreInfo.position().y );
}
public void keyPressed() { if(key == CODED && keyCode == SHIFT) mode.setBuilding(); }
public void keyReleased() { if(key == CODED && keyCode == SHIFT) mode.setPlaying(); }
public void mousePressed() { if(mode.isBuilding()) manager.buildCylinderBuilder(); }
void movieEvent(Movie m) { m.read(); }
}