-
Notifications
You must be signed in to change notification settings - Fork 0
/
MenuLoading.pde
61 lines (49 loc) · 1.2 KB
/
MenuLoading.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
/**
* Menu that shows when the game is loading
*
*/
class MenuLoading extends Menu{
/**
* Updates the menu
*/
MenuLoading () {
super();
}
/**
* Updates the menu
*/
@Override
void update() {
super.update();
}
/**
* Renders the menu
*/
@Override
void render() {
if (loc.y >= -height) {
pushMatrix();
translate(loc.x+width/2,loc.y+height/2);
fill(red(dynamicColor)/16, green(dynamicColor)/16, blue(dynamicColor)/16);
rect(0,0,width,height);
if (world.lr.finishingPoint != 0) {
float percent = (float)world.lr.doneCount/world.lr.finishingPoint;
// draw the loading bar
fill(red(dynamicColor)/3, green(dynamicColor)/3, blue(dynamicColor)/3);
rect(0,0,width*percent,height/2);
fill(red(dynamicColor)/8, green(dynamicColor)/8, blue(dynamicColor)/8,255*0.875);
textSize(50);
textAlign(CENTER,BOTTOM);
text((int)(percent*100)+"%", 0, 0);
textAlign(CENTER,TOP);
textSize(32);
text("Loading...", 0, 0);
// if loading is done, start the game sunny!
if (percent >= 1) {
on = false;
}
}
popMatrix();
}
}
}