Fixed the rotation pivot and added scalability
This commit is contained in:
parent
f25b07910e
commit
01af69cbc8
5 changed files with 33 additions and 21 deletions
|
|
@ -36,7 +36,7 @@ public abstract class Entity {
|
|||
this.name = name;
|
||||
location = new Vector2f();
|
||||
rotation = new Vector3f();
|
||||
size = new Vector2f();
|
||||
size = new Vector2f(1,1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -83,20 +83,20 @@ public abstract class Entity {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the size of the entity
|
||||
* Get the scale of the entity
|
||||
*
|
||||
* @return The Location of the entity
|
||||
*/
|
||||
public Vector2f getSize() {
|
||||
public Vector2f getScale() {
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* set the size of this entity in pixels
|
||||
* set the scale of this entity in pixels
|
||||
*
|
||||
* @param s The size of the entity
|
||||
*/
|
||||
public void setSize(Vector2f s) {
|
||||
public void setScale(Vector2f s) {
|
||||
size = s;
|
||||
}
|
||||
|
||||
|
|
@ -110,15 +110,19 @@ public abstract class Entity {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the location of the entity in opengl plus
|
||||
* the parameter values before rendering.
|
||||
* Sets the location of the entity in opengl
|
||||
*
|
||||
* @param x The value to add x
|
||||
* @param y The value to add y
|
||||
*/
|
||||
protected void setTranslationGL(float x, float y){
|
||||
// translate to the right location and prepare to draw
|
||||
GL11.glTranslatef(location.getX()+x, location.getY()+y, 0);
|
||||
GL11.glTranslatef(x,y, 0);
|
||||
}
|
||||
|
||||
protected void setScaleGL(){
|
||||
// translate to the right location and prepare to draw
|
||||
GL11.glScalef(size.getX(), size.getY(), 0.0f);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue