This is a big commit. Added mouse cursors and a load bar. Started whit the game. and many many other things
This commit is contained in:
parent
448fca2fdf
commit
4e7722fedb
34 changed files with 597 additions and 95 deletions
|
|
@ -3,6 +3,8 @@
|
|||
*/
|
||||
package ei.engine.scene;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import ei.engine.math.Vector2f;
|
||||
|
|
@ -118,18 +120,6 @@ public abstract class Entity {
|
|||
GL11.glTranslatef(location.getX(), location.getY(), location.getZ());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the location of the entity in opengl
|
||||
*
|
||||
* @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, float z){
|
||||
// translate to the right location and prepare to draw
|
||||
GL11.glTranslatef(x,y, z);
|
||||
}
|
||||
|
||||
protected void setScaleGL(){
|
||||
// translate to the right location and prepare to draw
|
||||
GL11.glScalef(size.getX(), size.getY(), size.getZ());
|
||||
|
|
@ -138,21 +128,33 @@ public abstract class Entity {
|
|||
/**
|
||||
* Sets the rotation of the entity in opengl
|
||||
* before rendering.
|
||||
*
|
||||
* @param rx The x coordinate of the center of rotation
|
||||
* @param ry The y coordinate of the center of rotation
|
||||
*/
|
||||
protected void setRotationGL(){
|
||||
protected void setRotationGL(float rx, float ry){
|
||||
//GL11.glTranslatef(rx,ry, location.getZ());
|
||||
// rotating the entity
|
||||
GL11.glRotatef(rotation.getX(), 1.0f, 0.0f, 0.0f); // Rotate On The X Axis
|
||||
GL11.glRotatef(rotation.getY(), 0.0f, 1.0f, 0.0f); // Rotate On The Y Axis
|
||||
GL11.glRotatef(rotation.getZ(), 0.0f, 0.0f, 1.0f); // Rotate On The Z Axis
|
||||
GL11.glTranslatef(-rx,-ry, location.getZ());
|
||||
}
|
||||
|
||||
|
||||
public boolean intersects(Entity e){
|
||||
return getBound().intersects(e.getBound());
|
||||
}
|
||||
|
||||
/**
|
||||
* the render method should be implemented for every entity
|
||||
* the render method can be implemented for every entity
|
||||
*/
|
||||
public abstract void render();
|
||||
public void render(){}
|
||||
|
||||
/**
|
||||
* the update method can be implemented for every entity
|
||||
*/
|
||||
public void update(){}
|
||||
|
||||
public abstract Rectangle getBound();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue