UIInputList affiche mtn seulement les nouvelles touches enfoncées cette frame
This commit is contained in:
parent
631437a1e9
commit
ec37cab5ef
@ -19,6 +19,8 @@ public class UIInputList extends UIDummy{
|
||||
private List<ObjectGl> listIcon;
|
||||
private ControllerPromptTextureLoader tex;
|
||||
|
||||
private boolean[] tab;
|
||||
|
||||
public UIInputList(InputBuffer inputBuffer, float size, float posX, float posY, float posZ, Engine engine){
|
||||
this.engine = engine;
|
||||
this.camera = engine.getCamera();
|
||||
@ -28,6 +30,7 @@ public class UIInputList extends UIDummy{
|
||||
this.zPos = posZ;
|
||||
this.inputBuffer = inputBuffer;
|
||||
this.tex = new ControllerPromptTextureLoader();
|
||||
this.tab = new boolean[8];
|
||||
}
|
||||
|
||||
public void init(){
|
||||
@ -57,39 +60,42 @@ public class UIInputList extends UIDummy{
|
||||
public void createNextButton(int i){
|
||||
boolean[] input = inputBuffer.getInputList()[i].getTab();
|
||||
ObjectGl obj = null;
|
||||
if (input[0]) {
|
||||
if (input[0] && !tab[0]) {
|
||||
// UP
|
||||
obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
|
||||
obj.setTexture(tex.up);
|
||||
} if (input[1]){
|
||||
} if (input[1] && !tab[1]){
|
||||
// DOWN
|
||||
obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
|
||||
obj.setTexture(tex.down);
|
||||
} if (input[2]){ //Pour l'instant on fait comme si l'avant était toujours à droite donc arrière à gauche
|
||||
} if (input[2] && !tab[2]){ //Pour l'instant on fait comme si l'avant était toujours à droite donc arrière à gauche
|
||||
// BACK
|
||||
obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
|
||||
obj.setTexture(tex.left);
|
||||
} if (input[3]){
|
||||
} if (input[3] && !tab[3]){
|
||||
// FORWARD
|
||||
obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
|
||||
obj.setTexture(tex.right);
|
||||
} if (input[4]){
|
||||
} if (input[4] && !tab[4]){
|
||||
// A
|
||||
obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
|
||||
obj.setTexture(tex.X);
|
||||
} if (input[5]){
|
||||
} if (input[5] && !tab[5]){
|
||||
// B
|
||||
obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
|
||||
obj.setTexture(tex.A);
|
||||
} if (input[6]){
|
||||
} if (input[6] && !tab[6]){
|
||||
// C
|
||||
obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
|
||||
obj.setTexture(tex.Y);
|
||||
} if (input[7]){
|
||||
} if (input[7] && !tab[7]){
|
||||
// D
|
||||
obj = new ObjectGl(100f, 10f, 10f, 10f, null, null);
|
||||
obj.setTexture(tex.B);
|
||||
}
|
||||
for (int k = 0; k < 8; k++){
|
||||
tab[k] = input[k];
|
||||
}
|
||||
if (obj != null){
|
||||
listIcon.add(obj);
|
||||
obj.setShader("shaders/ObjectGlTex/vert.glsl", "shaders/ObjectGlTex/frag.glsl");
|
||||
@ -101,15 +107,12 @@ public class UIInputList extends UIDummy{
|
||||
|
||||
createNextButton(this.posBuffer);
|
||||
|
||||
if(listIcon.size() > 30){
|
||||
if(listIcon.size() > 15){
|
||||
engine.remove_objectGl(listIcon.get(0));
|
||||
listIcon.remove(listIcon.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Encules les perfs :( le problème c'est forcement le chargement des textures
|
||||
*/
|
||||
public void update(){
|
||||
this.posBuffer = this.inputBuffer.getPos();
|
||||
createButtonList();
|
||||
|
@ -106,7 +106,7 @@ public class match {
|
||||
objP1.getShadow().translate(new Vector3f(0f,p1.getPosY(),0));
|
||||
objP2.getShadow().translate(new Vector3f(0f,p2.getPosY(),0));
|
||||
// Crée l'InputList
|
||||
inputListP1 = new UIInputList(inputsP1, 10f, 0f, 0.3f, 110f, engine);
|
||||
inputListP1 = new UIInputList(inputsP1, 10f, 0f, 0.85f, 110f, engine);
|
||||
engine.add_uiElement(inputListP1);
|
||||
inputListP1.init();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user