-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscreen_startup.pde
114 lines (91 loc) · 3.57 KB
/
screen_startup.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
105
106
107
108
109
110
111
112
113
114
public class Startup extends Screen {
float floatIn = 1.0;
float floatOut = 1.0;
int timeFromStart = 0;
boolean nextScreen = false;
boolean firstTimeStartup = false;
public Startup(TWEngine engine) {
super(engine);
// Kickstart gstreamer by playing default realm music (but also not really playing it)
sound.streamMusic(engine.APPPATH+engine.DEFAULT_MUSIC_PATH);
//sound.playSound("intro");
// if stats.json is missing, this means user is starting timeway for the first time.
firstTimeStartup = !file.exists(engine.APPPATH+engine.STATS_FILE());
}
public void upperBar() {
// Don't render the upper bar
}
public void lowerBar() {
// Don't render the lower bar
}
public void backg() {
app.fill(myBackgroundColor);
app.noStroke();
app.rect(0, 0, WIDTH, HEIGHT);
}
public void transitionAnimation() {
}
public void content() {
switch (engine.power.getPowerMode()) {
case HIGH:
timeFromStart++;
break;
case NORMAL:
timeFromStart += 2;
break;
case SLEEPY:
timeFromStart += 4;
break;
case MINIMAL:
timeFromStart++;
break;
}
// Yup we deliberately make the loading time longer just so we can display the logo
// long enough lol.
if (engine.isLoading() || timeFromStart < 30) {
floatIn *= 0.9;
app.tint(255, 255-(255*floatIn));
display.imgCentre("logo", WIDTH/2, HEIGHT/2 - floatIn*100);
ui.loadingIcon(WIDTH/2, HEIGHT*0.8);
// TODO: add loading notes, including "caching CPU canvas"
}
// Logo fade out as the screen moves away.
else {
floatOut *= 0.9;
app.tint(255, (255*floatOut));
display.imgCentre("logo", WIDTH/2, HEIGHT/2);
// Only executes once
if (!nextScreen) {
nextScreen = true;
// Setting this to true will tell the engine to give a quick fps test to the first
// screen we go into so that we can smoothly go into a suitable framerate.
engine.initialScreen = true;
// This is the part where we exit the welcome screen and go to our main screen.
Explorer screen = new Explorer(engine);
requestScreen(screen);
}
}
// Author name below
app.noStroke();
app.textAlign(CENTER, CENTER);
app.textFont(engine.DEFAULT_FONT, 34);
app.fill(0, 255-(255*floatIn));
app.text("by Teo Taylor", WIDTH/2-3, HEIGHT/2+150-3);
app.fill(255, 255-(255*floatIn));
app.text("by Teo Taylor", WIDTH/2, HEIGHT/2+150);
// First time startup
//if (firstTimeStartup) {
// app.text("First startup make take some time, please wait...", WIDTH/2, HEIGHT/2+400);
//}
// Version in bottom-right.
app.noTint();
app.fill(255);
app.noStroke();
app.textAlign(LEFT, CENTER);
app.textFont(engine.DEFAULT_FONT, 30);
app.fill(0, 255-(255*floatIn));
app.text(engine.getVersion(), 10-3, HEIGHT-30-3);
app.fill(255, 255-(255*floatIn));
app.text(engine.getVersion(), 10, HEIGHT-30);
}
}