Changed Entity to 3d axis and added a fpstimer that calculates the fps
This commit is contained in:
parent
ec551064c4
commit
28c3cd0529
11 changed files with 222 additions and 72 deletions
|
|
@ -19,16 +19,13 @@ public abstract class Entity {
|
|||
private String name;
|
||||
|
||||
/** The location of this entity in pixels*/
|
||||
private Vector2f location;
|
||||
private Vector3f location;
|
||||
|
||||
/** The rotation of this entity in pixels*/
|
||||
private Vector3f rotation;
|
||||
|
||||
/** The size of this entity in pixels*/
|
||||
private Vector2f size;
|
||||
|
||||
/** The z layer of the screen*/
|
||||
private int z = 0;
|
||||
private Vector3f size;
|
||||
|
||||
/**
|
||||
* creates a new entity
|
||||
|
|
@ -37,9 +34,9 @@ public abstract class Entity {
|
|||
*/
|
||||
public Entity(String name){
|
||||
this.name = name;
|
||||
location = new Vector2f();
|
||||
location = new Vector3f();
|
||||
rotation = new Vector3f();
|
||||
size = new Vector2f(1,1);
|
||||
size = new Vector3f(1,1,1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -48,31 +45,13 @@ public abstract class Entity {
|
|||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the z value of the entity
|
||||
*
|
||||
* @return The z value
|
||||
*/
|
||||
public int getZ() {
|
||||
return z;
|
||||
}
|
||||
|
||||
/**
|
||||
* set the z value of the entity
|
||||
*
|
||||
* @param l The z value to set
|
||||
*/
|
||||
public void setZ(int l) {
|
||||
z = l;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Location of the entity
|
||||
*
|
||||
* @return The Location of the entity
|
||||
*/
|
||||
public Vector2f getLocation() {
|
||||
public Vector3f getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
|
|
@ -81,10 +60,19 @@ public abstract class Entity {
|
|||
*
|
||||
* @param l The location of the entity
|
||||
*/
|
||||
public void setLocation(Vector2f l) {
|
||||
public void setLocation(Vector3f l) {
|
||||
location = l;
|
||||
}
|
||||
|
||||
/**
|
||||
* set the location of this entity in pixels
|
||||
*
|
||||
* @param l The location of the entity
|
||||
*/
|
||||
public void setLocation(Vector2f l) {
|
||||
location = new Vector3f(l.getX(),l.getY(),getLocation().getZ());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the rotation of the entity
|
||||
*
|
||||
|
|
@ -108,7 +96,7 @@ public abstract class Entity {
|
|||
*
|
||||
* @return The Location of the entity
|
||||
*/
|
||||
public Vector2f getScale() {
|
||||
public Vector3f getScale() {
|
||||
return size;
|
||||
}
|
||||
|
||||
|
|
@ -117,7 +105,7 @@ public abstract class Entity {
|
|||
*
|
||||
* @param s The size of the entity
|
||||
*/
|
||||
public void setScale(Vector2f s) {
|
||||
public void setScale(Vector3f s) {
|
||||
size = s;
|
||||
}
|
||||
|
||||
|
|
@ -135,15 +123,16 @@ public abstract class Entity {
|
|||
*
|
||||
* @param x The value to add x
|
||||
* @param y The value to add y
|
||||
* @param z The value to add z
|
||||
*/
|
||||
protected void setTranslationGL(float x, float y){
|
||||
protected void setTranslationGL(float x, float y, float z){
|
||||
// translate to the right location and prepare to draw
|
||||
GL11.glTranslatef(x,y, 0);
|
||||
GL11.glTranslatef(x,y, z);
|
||||
}
|
||||
|
||||
protected void setScaleGL(){
|
||||
// translate to the right location and prepare to draw
|
||||
GL11.glScalef(size.getX(), size.getY(), 0.0f);
|
||||
GL11.glScalef(size.getX(), size.getY(), size.getZ());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue