Plus de problème de perf

This commit is contained in:
Antoine 2021-06-18 22:02:00 +02:00
parent d06411aff2
commit 631437a1e9

View File

@ -56,70 +56,55 @@ public class UIInputList extends UIDummy{
public void createNextButton(int i){
boolean[] input = inputBuffer.getInputList()[i].getTab();
ObjectGl obj = null;
if (input[0]) {
// UP
ObjectGl obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
obj.setTexture(tex.up);
listIcon.add(obj);
} if (input[1]){
// DOWN
ObjectGl obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
obj.setTexture(tex.down);
listIcon.add(obj);
} if (input[2]){ //Pour l'instant on fait comme si l'avant était toujours à droite donc arrière à gauche
// BACK
ObjectGl obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
obj.setTexture(tex.left);
listIcon.add(obj);
} if (input[3]){
// FORWARD
ObjectGl obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
obj.setTexture(tex.right);
listIcon.add(obj);
} if (input[4]){
// A
ObjectGl obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
obj.setTexture(tex.X);
listIcon.add(obj);
} if (input[5]){
// B
ObjectGl obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
obj.setTexture(tex.A);
listIcon.add(obj);
} if (input[6]){
// C
ObjectGl obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
obj.setTexture(tex.Y);
listIcon.add(obj);
} if (input[7]){
// D
ObjectGl obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
obj.setTexture(tex.B);
listIcon.add(obj);
}
for (ObjectGl obj : listIcon){
if (obj != null){
listIcon.add(obj);
obj.setShader("shaders/ObjectGlTex/vert.glsl", "shaders/ObjectGlTex/frag.glsl");
engine.add_objectGl(obj);
}
}
public void createButtonList(){
engine.remove_objectsGl(listIcon);
listIcon = new ArrayList<>();
createNextButton(this.posBuffer);
int count = 0;
int index = this.posBuffer;
do {
createNextButton(index);
index --;
count ++;
if (index < 0){
index = this.sizeBuffer - 1;
}
} while(count < 30);
Collections.reverse(listIcon);
engine.add_objectsGl(listIcon);
if(listIcon.size() > 30){
engine.remove_objectGl(listIcon.get(0));
listIcon.remove(listIcon.get(0));
}
}
/**