Premier jet pour les élements d'interface encore pas mal de truc à regler
This commit is contained in:
@ -117,8 +117,8 @@ public class ObjectGl {
|
||||
this.xPos += vec.x;
|
||||
this.yPos += vec.y;
|
||||
this.zPos += vec.z;
|
||||
vec.divXY(this.scalingFactor);
|
||||
this.transform = this.transform.multiply(Matrix4f.translate(vec));
|
||||
Vector3f vecTemp = vec.divXYZ(this.scalingFactor);
|
||||
this.transform = this.transform.multiply(Matrix4f.translate(vecTemp));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,12 +58,23 @@ public class Text {
|
||||
|
||||
}
|
||||
|
||||
public void translate(Vector3f vec){
|
||||
// TODO ET LA TRANSLATION DES NOUVEAUX ELEMENTS ?????????????????
|
||||
for (ObjectGl obj : this.charList){
|
||||
obj.translate(vec);
|
||||
}
|
||||
}
|
||||
|
||||
public void remove(){
|
||||
for (ObjectGl obj : this.charList){
|
||||
this.engine.remove_objectGl(obj);
|
||||
}
|
||||
}
|
||||
|
||||
public List<ObjectGl> getObj(){
|
||||
return new ArrayList<>(this.charList);
|
||||
}
|
||||
|
||||
private void removeFromIndexToEnd(int i){
|
||||
int j = 0;
|
||||
for (ObjectGl objectGl : this.charList){
|
||||
|
35
src/engine/object/UIElement.java
Normal file
35
src/engine/object/UIElement.java
Normal file
@ -0,0 +1,35 @@
|
||||
package engine.object;
|
||||
|
||||
import engine.Engine;
|
||||
import engine.math.Vector3f;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class UIElement {
|
||||
|
||||
private List<ObjectGl> objs;
|
||||
private Engine engine;
|
||||
|
||||
public UIElement(List<ObjectGl> objs, Engine engine){
|
||||
this.objs = new ArrayList<>();
|
||||
this.objs.addAll(objs);
|
||||
this.engine = engine;
|
||||
}
|
||||
|
||||
public void addObj(ObjectGl obj){
|
||||
this.objs.add(obj);
|
||||
}
|
||||
|
||||
public void addObj(List<ObjectGl> objs){
|
||||
this.objs.addAll(objs);
|
||||
}
|
||||
|
||||
public void update(){
|
||||
for (ObjectGl obj : this.objs){
|
||||
obj.translate(new Vector3f(-engine.transformationView.x, engine.transformationView.y)); // Tous les elmts font le même déplacement que la caméra
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user