delete in UIElement added

This commit is contained in:
Antoine 2021-06-23 17:57:44 +02:00
parent c5ac0e9297
commit 6b6cb0beda
6 changed files with 24 additions and 3 deletions

View File

@ -206,6 +206,10 @@ public class Engine {
this.uiElements.add(uiElement);
}
public void remove_uiElement(UIDummy uiElement) {
this.uiElements.remove(uiElement);
}
public void setUIElementZoomFactor(float scaleFactor){
for (UIDummy uiElement : this.uiElements){
uiElement.updateScalingFactor(scaleFactor);

View File

@ -18,6 +18,9 @@ public abstract class UIDummy {
public void init(){
}
public void delete(){
}
protected void getObjInPosition(){
}

View File

@ -37,6 +37,10 @@ public class UIElement extends UIDummy{
this.engine.add_objectGl(obj);
}
public void delete(){
this.engine.remove_objectGl(obj);
}
protected void getObjInPosition(){
obj.resetTransform();
obj.scale(new Vector3f(this.scalingFactor, this.scalingFactor, 1.0f));

View File

@ -53,6 +53,12 @@ public class UIElementText extends UIDummy{
}
}
public void delete(){
for (ObjectGl obj : this.txt.getCharList()){ //Cast en ObjectGl
this.engine.remove_objectGl(obj);
}
}
/**
* Modifier le texte
* @param txt le nouveau texte

View File

@ -5,10 +5,8 @@ import engine.loader.ControllerPromptTextureLoader;
import engine.math.Vector3f;
import engine.object.ObjectGl;
import gameplay.input.InputBuffer;
import gameplay.input.Inputs;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class UIInputList extends UIDummy{
@ -39,6 +37,12 @@ public class UIInputList extends UIDummy{
this.listIcon = new ArrayList<>();
}
public void delete(){
for (ObjectGl obj : this.listIcon){ //Cast en ObjectGl
this.engine.remove_objectGl(obj);
}
}
protected void getObjInPosition(){
int index = 0;
for (ObjectGl obj : listIcon){

View File

@ -83,7 +83,7 @@ public class match {
private static UIInputList inputListP1;
// Debug
public static boolean showP1Hitbox = false; // TODO modifier pour le rendre activable
public static boolean showP1Hitbox = false;
public static boolean showP2Hitbox = false;
private static List<Hitbox> listHitboxObj = new ArrayList<>();
private static float slowFactor = 1f;