-
Notifications
You must be signed in to change notification settings - Fork 0
/
PMStage.pde
104 lines (86 loc) · 2.16 KB
/
PMStage.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
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
class ProgressManagerStage {
int stageIndex;
String name;
PGraphics graphicsPreview;
String details;
boolean inProgress;
boolean thumbnailAdded;
boolean detailsAdded;
/* hard coded variables */
int textSize = 20;
color textColor = color(0);
color inProgressTextColor = color(0, 255, 0);
int inProgressTextSize = textSize;
float previewWidth = 170;
float previewHeight;
int previewYOffset = 100;
int detailsYOffset = 20;
int textOffset = textSize * 2;
int detailsTextSize = 10;
color detailsTextColor = color(255);
//consturctor
ProgressManagerStage (String _name, int _index) {
stageIndex = _index;
name = _name;
/* init */
inProgress = false;
detailsAdded = false;
graphicsPreview = createGraphics(posterWidth, posterHeight);
}
void display(float x, float y) {
pushMatrix();
pushStyle();
translate(x, y);
textAlign(LEFT);
/* highlight stage in progress */
if (inProgress) {
textSize(inProgressTextSize);
fill(inProgressTextColor);
} else {
textSize(textSize);
fill(textColor);
}
noStroke();
box(20);
text(name, 0, textOffset);
textAlign(LEFT, TOP);
if (thumbnailAdded) {
previewHeight = (Float)(previewWidth/graphicsPreview.width) * graphicsPreview.height;
image(graphicsPreview, 0, previewYOffset, previewWidth, previewHeight);
}
if (detailsAdded) {
textSize(detailsTextSize);
fill(detailsTextColor);
text(details, 0, previewHeight + previewYOffset + detailsYOffset, previewWidth, 10000);
}
popStyle();
popMatrix();
}
void addThumbnail(PGraphics pg) {
graphicsPreview = pg;
thumbnailAdded = true;
}
void addDetails(String _details) {
details = _details;
detailsAdded = true;
}
void reset() {
thumbnailAdded = false;
detailsAdded = false;
inProgress = false;
graphicsPreview = null;
details = "";
}
}
////////////////////////////////////////////////////
class StageInfo {
PGraphics thumbnail;
String details;
StageInfo(String _de, PGraphics _thu) {
details = _de;
thumbnail = _thu;
}
StageInfo(String _de) {
details = _de;
}
}