-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIntro.pde
103 lines (78 loc) · 1.83 KB
/
Intro.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
public class Intro extends Transitionable {
PImage[] slides;
int maxSlide = 3;
int index = 0;
ContBtn contBtn;
BackBtn backBtn;
protected void _setup() {
slides = new PImage[] {a.slide1, a.slide2, a.slide3, a.slide4};
contBtn = new ContBtn(m);
backBtn = new BackBtn(m);
contBtn.setup();
backBtn.setup();
}
protected void _update() {
image(slides[index], m.cw, m.ch);
contBtn.update();
backBtn.update();
if (contBtn.clicked) {
if (index == maxSlide) {
trans = true;
} else if ((index + 1) <= maxSlide) {
index++;
}
} else if (backBtn.clicked && (index - 1) >= 0) {
index--;
}
}
protected void onTransOutBegin() {
doingIntro = false;
}
// Uses cont
private class ContBtn extends Btn {
public static final String cont = "Next";
public static final String sta = "Start Game";
protected void _setup() {
w = 100;
h = 50;
x = Snap.w - 10 - w;
y = Snap.h - 10;
txt_size = 15;
icon_size = 20;
txt = cont;
icon = a.cont;
icon_space = 40;
txt_space = 10;
cornerToCenter();
}
protected void preUpdate() {
super.preUpdate();
// Update the txt
// and maybe the icon
if (m.intro.index == m.intro.maxSlide) {
txt = sta;
} else {
txt = cont;
}
}
public ContBtn(Snap app) { super(app); }
}
// Uses back as an icon
private class BackBtn extends Btn {
protected void _setup() {
w = 100;
h = 50;
x = 10;
y = Snap.h - 10;
txt_size = 20;
icon_size = 20;
txt = "Back";
icon = a.backS;
icon_space = 35;
txt_space = 0;
cornerToCenter();
}
public BackBtn(Snap app) { super(app); }
}
public Intro(Snap app) { super(app); }
}