Repository navigation
Expand file tree
/
Copy pathLayerText.java
More file actions
74 lines (54 loc) · 1.64 KB
/
Copy pathLayerText.java
File metadata and controls
74 lines (54 loc) · 1.64 KB
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
import processing.core.PFont;
import javax.media.opengl.GL2;
import controlP5.Group;
import controlP5.Tab;
public class LayerText extends LayerMovement {
//OPENGL
//private PGraphicsOpenGL pgl=null;
private static PFont font = null;
private static int size=0;
private String text=null;
public LayerText(Application parent) {
super(parent);
setParameterMap();
}
public void draw(GL2 gl) {
if(text!=null&&fgAlpha.v()>0){
parent.pushMatrix();
parent.translate(Config.WIDTH/2,Config.HEIGHT/2);
parent.scale(zoom.v());
parent.rotate(angle.v());
parent.translate(-Config.WIDTH,-Config.HEIGHT);
parent.translate(scrollX.v()*2,scrollY.v()*2);
if(LayerText.font==null||LayerText.size!=Config.WIDTH *Config.HEIGHT){
LayerText.font=parent.loadFont(Config.FONT);
//resizing the window break the font :/
LayerText.size=Config.WIDTH *Config.HEIGHT;
}
if(LayerText.font!=null){
int fontsize=30;
parent.textFont(LayerText.font,fontsize);
gl.glClear(GL2.GL_DEPTH_BUFFER_BIT);
parent.fill( foregroundR, foregroundG, foregroundB,fgAlpha.v()*255);
parent.text(text,Config.WIDTH-parent.textWidth(text)/2,Config.HEIGHT+fontsize/2);
}
parent.popMatrix();
/*parent.translate(-scrollX.v()*2,-scrollY.v()*2);
parent.translate(Config.WIDTH,Config.HEIGHT);
parent.rotate(-angle.v());
parent.scale(1/zoom.v());
parent.translate(-Config.WIDTH,-Config.HEIGHT);*/
}
}
@Override
public int buildUI(GUIController controller,int x, int y, Tab tab, Group group) {
return(0);
}
@Override
public void drawBackground(GL2 gl) {
}
@Override
public void update() {
super.update();
}
}