2007-03-13 18:37:22 +00:00
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
package ei.engine.scene;
|
|
|
|
|
|
2007-03-15 19:52:28 +00:00
|
|
|
import ei.engine.math.Vector2f;
|
2007-03-13 18:37:22 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This class is the root class of all the objects that
|
|
|
|
|
* will show on the scrren. This class handles the position
|
|
|
|
|
* and rotation and the colitions of the objects.
|
|
|
|
|
* @author Ziver
|
|
|
|
|
*/
|
|
|
|
|
public abstract class Entity {
|
|
|
|
|
/** The name of this sprite */
|
|
|
|
|
private String name;
|
|
|
|
|
|
|
|
|
|
/** The location of this entity in pixels*/
|
2007-03-15 19:52:28 +00:00
|
|
|
private Vector2f location;
|
2007-03-13 18:37:22 +00:00
|
|
|
|
|
|
|
|
/** The rotation of this entity in pixels*/
|
2007-03-15 19:52:28 +00:00
|
|
|
private Vector2f rotation;
|
2007-03-13 18:37:22 +00:00
|
|
|
|
|
|
|
|
/** The size of this entity in pixels*/
|
2007-03-15 19:52:28 +00:00
|
|
|
private Vector2f size;
|
2007-03-13 18:37:22 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* creates a new entity
|
|
|
|
|
*
|
|
|
|
|
* @param name The name of the entity
|
|
|
|
|
*/
|
|
|
|
|
public Entity(String name){
|
|
|
|
|
this.name = name;
|
2007-03-15 19:52:28 +00:00
|
|
|
location = new Vector2f(0,0);
|
2007-03-13 18:37:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return The name of the entity
|
|
|
|
|
*/
|
|
|
|
|
public String getName() {
|
|
|
|
|
return name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the Location of the entity
|
|
|
|
|
*
|
|
|
|
|
* @return The Location of the entity
|
|
|
|
|
*/
|
2007-03-15 19:52:28 +00:00
|
|
|
public Vector2f getLocation() {
|
2007-03-13 18:37:22 +00:00
|
|
|
return location;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* set the location of this entity in pixels
|
|
|
|
|
*
|
|
|
|
|
* @param l The location of the entity
|
|
|
|
|
*/
|
2007-03-15 19:52:28 +00:00
|
|
|
public void setLocation(Vector2f l) {
|
2007-03-13 18:37:22 +00:00
|
|
|
location = l;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the rotation of the entity
|
|
|
|
|
*
|
|
|
|
|
* @return The Location of the entity
|
|
|
|
|
*/
|
2007-03-15 19:52:28 +00:00
|
|
|
public Vector2f getRotation() {
|
2007-03-13 18:37:22 +00:00
|
|
|
return rotation;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* set the rotation of this entity in pixels
|
|
|
|
|
*
|
|
|
|
|
* @param r The rotation of the entity
|
|
|
|
|
*/
|
2007-03-15 19:52:28 +00:00
|
|
|
public void setRotation(Vector2f r) {
|
2007-03-13 18:37:22 +00:00
|
|
|
rotation = r;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the size of the entity
|
|
|
|
|
*
|
|
|
|
|
* @return The Location of the entity
|
|
|
|
|
*/
|
2007-03-15 19:52:28 +00:00
|
|
|
public Vector2f getSize() {
|
2007-03-13 18:37:22 +00:00
|
|
|
return size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* set the size of this entity in pixels
|
|
|
|
|
*
|
|
|
|
|
* @param s The size of the entity
|
|
|
|
|
*/
|
2007-03-15 19:52:28 +00:00
|
|
|
public void setSize(Vector2f s) {
|
2007-03-13 18:37:22 +00:00
|
|
|
size = s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2007-03-15 19:52:28 +00:00
|
|
|
* the render method should be implemented for every entity
|
2007-03-13 18:37:22 +00:00
|
|
|
*/
|
|
|
|
|
public abstract void render();
|
2007-03-15 19:52:28 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* the update method can be implemented for every entity
|
|
|
|
|
*/
|
|
|
|
|
public void update(){}
|
2007-03-13 18:37:22 +00:00
|
|
|
}
|