-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRestext.pde
133 lines (113 loc) · 2.48 KB
/
Restext.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
class Restext{
PFont f;
String text = "VJ Pupper";
float xpos=width/2,ypos =height/2;
float xspeed = 0;
float yspeed = 0;
float size = 32;
float rotspeed = 0;
float rotpos = 0;
boolean restorbounce;
int xdir = 1;
int ydir = 1;
// CONSTRUCTORES
Restext(){}
Restext(String _text){
text = _text;
}
Restext(float _xpos, float _ypos){
xpos = _xpos;
ypos = _ypos;
}
Restext(String _text,float _xpos, float _ypos){
text = _text;
xpos = _xpos;
ypos = _ypos;
}
Restext(String _text,float _xpos, float _ypos,float _xspeed, float _yspeed){
text = _text;
xpos = _xpos;
ypos = _ypos;
xspeed = _xspeed;
yspeed = _yspeed;
}
Restext(String _text,float _xpos, float _ypos,float _xspeed, float _yspeed,float _rotspeed){
text = _text;
xpos = _xpos;
ypos = _ypos;
xspeed = _xspeed;
yspeed = _yspeed;
rotspeed = _rotspeed;
}
// DISPLAY
void display (){
PFont f;
f = createFont("Arial",45,false);
textFont(f,size);
pushMatrix();
translate(xpos,ypos);
rotpos += rotspeed;
rotate(radians(rotpos));
text(text,0,0);
popMatrix();
}
void display(String text) {
PFont f;
f = createFont("Arial",45,true);
textFont(f,size);
pushMatrix();
translate(xpos,ypos);
rotpos += rotspeed;
rotate(radians(rotpos));
text(text,0,0);
popMatrix();
}
void display(String text,float _size) {
PFont f;
f = createFont("Arial",45,true);
textFont(f,_size);
pushMatrix();
translate(xpos,ypos);
rotpos += rotspeed;
rotate(radians(rotpos));
text(text,0,0);
popMatrix();
}
void rotar(float _rotpos){
rotpos =_rotpos;
}
void move () {
xpos += xspeed * xdir;
ypos += yspeed * ydir;
}
void move (float xspeed, float yspeed) {
xpos += xspeed * xdir;
ypos += yspeed * ydir;
println(xspeed);
println(yspeed);
}
void restorbounce(boolean restorbounce ){
if (restorbounce){
if (xpos > width || xpos < 0){
xdir *= -1;
}
if (ypos > height || ypos < 0) {
ydir *= -1;
}
}
else{
if (xpos > width ){
xpos = 0;
}
if (ypos > height){
ypos = 0;
}
if (xpos < 0 ){
xpos = width;
}
if (ypos < 0 ){
ypos = height;
}
}
}
}