-
Notifications
You must be signed in to change notification settings - Fork 0
/
TitleState.pde
53 lines (48 loc) · 1.24 KB
/
TitleState.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
class TitleState extends State {
private PImage back;
private Button b;
private int i_selected_song;
private int t_lock=70, t_locked=0;
TitleState(){
back = loadImage("tatsujin.png");
i_selected_song = 1;
selected_song = songs[i_selected_song];
}
void drawState() {
if(millis() - t_locked > t_lock){
b = controller.get_input();
if(b == Button.SHITA){
i_selected_song = (i_selected_song + 1) % songs.length;
selected_song = songs[i_selected_song];
}
if(b == Button.UE){
if(i_selected_song == 0)
i_selected_song = songs.length-1;
else
i_selected_song--;
selected_song = songs[i_selected_song];
}
t_locked = millis();
}
background(255);
image(back, 100, 100, back.width/2, back.height/2);
strokeWeight(4);
translate(0, 700);
for(int i=0; i<4; i++){
noFill();
rect(40, 40+i*60, width-100, 50);
if(songs[i] == selected_song){
stroke(255, 0, 0);
rect(38, 38+i*60, width-96, 54);
}
fill(0);
stroke(0, 0, 0);
text(songs[i].name, 50, 60*(i+1)+23);
}
}
State nextState() {
if (b == Button.MIGI)
return new CountState();
return this;
}
}