Added remove method in Text.java

This commit is contained in:
Antoine 2021-06-03 20:19:58 +02:00
parent a6f25bb75b
commit 9cb1bcc12d
2 changed files with 8 additions and 2 deletions

View File

@ -230,7 +230,7 @@ public class Engine {
background.translate(new Vector3f(-3011.0f, 1400.0f, 1.0f));
engine.add_objectGl(background);
Text TexTest = new Text("ABCDEFGHIJKLMNOPQRSTUVWXYZ",20.0f, 10, engine);
Text texTest = new Text("ABCDEFGHIJKLMNOPQRSTUVWYZ",20.0f, 10, engine);
long timer = System.currentTimeMillis();
long lastFrame;

View File

@ -33,6 +33,12 @@ public class Text {
}
}
public void remove(){
for (ObjectGl obj : this.charList){
this.engine.remove_objectGl(obj);
}
}
private ObjectGl charToObjectGl(char a){
ObjectGl objectGl = new ObjectGl(this.zPos, 1.0f, 1.0f, this.size, "textures/dejavu10x10_gs_tc.png", null);
objectGl.setShader("shaders/StylishShaders/BasicVert.glsl","shaders/StylishShaders/TextFrag.glsl");
@ -40,7 +46,7 @@ public class Text {
objectGl.setTextureWrap(0.0f + (a - 97) * 10.0f,40.0f,10.0f,10.0f, ObjectGl.DEFAULT);
}
else if (a < 91 && a > 64){
objectGl.setTextureWrap(0.0f + (a - 97) * 10.0f,30.0f,10.0f,10.0f, ObjectGl.DEFAULT);
objectGl.setTextureWrap(0.0f + (a - 65) * 10.0f,30.0f,10.0f,10.0f, ObjectGl.DEFAULT);
}
return objectGl;
}