-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNewSong.pde
73 lines (61 loc) · 1.25 KB
/
NewSong.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
class NewSong {
// The new song datatype
NewSong previousSong, nextSong;
private float x, y;
private float endY;
private String display;
private String artist;
private int lineCount;
public NewSong(String song, String name) {
this(song, name, defaultX, defaultY);
}
public NewSong(String song, String name, float x, float y) {
display = song.trim();
this.x = x;
this.y = y;
artist = name;
lineCount = display.split("\n").length;
setEndPos();
}
public String getSong() {
return display;
}
public void setPrevious(NewSong other) {
previousSong = other;
}
public void setNext(NewSong other) {
nextSong = other;
}
public void setPos(float X, float Y) {
this.x = X;
this.y = Y;
setEndPos();
}
private void setEndPos() {
endY = y + lineCount * lineHeight;
}
public NewSong getPrevious() {
return previousSong;
}
public NewSong getNext() {
return nextSong;
}
public String getArtist() {
return artist;
}
public float getX() {
return x;
}
public float getY() {
return y;
}
public float getEndY() {
return endY;
}
public void move() {
if (getNext() != null)
getNext().move();
y -= speed;
setEndPos();
}
}