diff --git a/jinput-dx8.dll b/jinput-dx8.dll new file mode 100644 index 0000000..038401b Binary files /dev/null and b/jinput-dx8.dll differ diff --git a/jinput-raw.dll b/jinput-raw.dll new file mode 100644 index 0000000..043783a Binary files /dev/null and b/jinput-raw.dll differ diff --git a/log.txt b/log.txt index e69de29..49a141e 100644 --- a/log.txt +++ b/log.txt @@ -0,0 +1 @@ +2007-04-08 17:55:07:843 # Loading texture: data/units/tank.png diff --git a/raw/media/font/mirrored_font.xcf b/raw/media/font/mirrored_font.xcf new file mode 100644 index 0000000..ac089a8 Binary files /dev/null and b/raw/media/font/mirrored_font.xcf differ diff --git a/raw/media/font/org_font.bmp b/raw/media/font/org_font.bmp new file mode 100644 index 0000000..093cb0b Binary files /dev/null and b/raw/media/font/org_font.bmp differ diff --git a/src/ei/engine/effects/BitmapText.java b/src/ei/engine/effects/BitmapText.java index 6c52c9c..4c81e51 100644 --- a/src/ei/engine/effects/BitmapText.java +++ b/src/ei/engine/effects/BitmapText.java @@ -112,4 +112,9 @@ public class BitmapText extends Entity{ // TODO Auto-generated method stub return null; } + + @Override + public Texture getTexture() { + return texture; + } } diff --git a/src/ei/engine/effects/Fade.java b/src/ei/engine/effects/Fade.java new file mode 100644 index 0000000..3d6ea92 --- /dev/null +++ b/src/ei/engine/effects/Fade.java @@ -0,0 +1,99 @@ +package ei.engine.effects; + +import java.awt.Rectangle; + +import org.lwjgl.opengl.GL11; + +import ei.engine.scene.Entity; +import ei.engine.texture.Texture; + +/** + * Fades out/in Things + * @author Ziver + * + */ +public class Fade extends Entity{ + // The entity to fade + private Entity entity; + + //Temp variables + private float life; + private boolean fadeOut; + private float fade; + + public Fade(String name) { + super(name); + life = 1.0f; + fadeOut = true; + fade = 0.01f; + } + + /** + * Draws out the fade and the entity + */ + public void render(){ + // store the current model matrix + GL11.glPushMatrix(); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); + + entity.getTexture().getColor().setA(life); + entity.render(); + + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + // restore the model view matrix to prevent contamination + GL11.glPopMatrix(); + } + + /** + * Updates the fade and the entity + */ + public void update(){ + if(fadeOut){ + if(life > 0)life -= fade; + else life = 0; + } + else{ + if(life < 1)life += fade; + else life = 1; + } + entity.update(); + System.out.println(life); + } + + public void setEntity(Entity e){ + entity = e; + } + + /** + * Set the time of the fade + * + * @param f The time of the fade + */ + public void setFade(float f){ + fade = f; + } + + /** + * Set if the object should fade out or in + * + * @param b True for fade out false for fade in + */ + public void fadeOut(boolean b){ + fadeOut = b; + if(fadeOut)life = 1.0f; + else life = 0.0f; + } + + /** + * Get the bounds of the entity + */ + public Rectangle getBound() { + return entity.getBound(); + } + + @Override + public Texture getTexture() { + return entity.getTexture(); + } + +} diff --git a/src/ei/engine/effects/Particles.java b/src/ei/engine/effects/Particles.java index 5c9ad72..3694626 100644 --- a/src/ei/engine/effects/Particles.java +++ b/src/ei/engine/effects/Particles.java @@ -272,6 +272,11 @@ public class Particles extends Entity{ (int)getLocation().getY(), (int)size, (int)size); } + + @Override + public Texture getTexture() { + return texture; + } } class Particle { // Particles Structure diff --git a/src/ei/engine/effects/ProgressBar.java b/src/ei/engine/effects/ProgressBar.java index 77da6ec..23286cf 100644 --- a/src/ei/engine/effects/ProgressBar.java +++ b/src/ei/engine/effects/ProgressBar.java @@ -7,6 +7,7 @@ import ei.engine.math.Vector2f; import ei.engine.math.Vector3f; import ei.engine.scene.Entity; import ei.engine.scene.Sprite; +import ei.engine.texture.Texture; /** * This class is a progress meter @@ -217,4 +218,9 @@ public class ProgressBar extends Entity{ return null; } } + + @Override + public Texture getTexture() { + return bar.getTexture(); + } } diff --git a/src/ei/engine/math/Vector4f.java b/src/ei/engine/math/Vector4f.java new file mode 100644 index 0000000..cd0b28d --- /dev/null +++ b/src/ei/engine/math/Vector4f.java @@ -0,0 +1,132 @@ +package ei.engine.math; + +/** + * This class holds 3 float values + * + * @author Ziver + */ + +public class Vector4f { + private float r; + private float g; + private float b; + private float a; + + /** + * Creates a vector whit the value zero + */ + public Vector4f(){ + this(0,0,0,0); + } + + /** + * Creates a Vector by the given values + * + * @param r The r value + * @param g The g value + * @param b The b value + * @param a The a value + */ + public Vector4f(float r, float g, float b, float a){ + this.r = r; + this.g = g; + this.b = b; + this.a = a; + } + + /** + * Get the R value + * + * @return the r value in the vector + */ + public float getR(){ + return r; + } + + /** + * Get the G value + * + * @return the g value in the vector + */ + public float getG(){ + return g; + } + + /** + * Get the B value + * + * @return the b value in the vector + */ + public float getB(){ + return b; + } + + /** + * Get the A value + * + * @return the a value in the vector + */ + public float getA(){ + return a; + } + + /** + * Set the A value + * + * param the a value in the vector + */ + public void setA(float a){ + this.a = a; + } + + /** + * Add to the vector + * + * @param i The amount to add + */ + public void add(float i){ + r += i; + g += i; + b += i; + } + + /** + * Add to the vector + * + * @param i The amount to add + */ + public void add(Vector4f i){ + r += i.getR(); + g += i.getG(); + b += i.getB(); + a += i.getA(); + } + + /** + * Add to the vector + * + * @param r The value to add to the r value + * @param g The value to add to the g value + * @param b The value to add to the b value + * @param a The value to add to the a value + */ + public void add(float r, float g, float b, float a){ + this.r += r; + this.g += g; + this.b += b; + this.a += a; + } + + /** + * Returns a copy of this vector + * + * @return A copy of this vector + */ + public Vector4f getCopy(){ + return new Vector4f(r,g,b,a); + } + + public String toString(){ + return "Vector4f["+r+","+g+","+b+","+a+"]"; + } +} diff --git a/src/ei/engine/scene/Entity.java b/src/ei/engine/scene/Entity.java index d49a7c4..cc8d355 100644 --- a/src/ei/engine/scene/Entity.java +++ b/src/ei/engine/scene/Entity.java @@ -9,6 +9,7 @@ import org.lwjgl.opengl.GL11; import ei.engine.math.Vector2f; import ei.engine.math.Vector3f; +import ei.engine.texture.Texture; /** * This class is the root class of all the objects that @@ -157,4 +158,6 @@ public abstract class Entity { public void update(){} public abstract Rectangle getBound(); + + public abstract Texture getTexture(); } diff --git a/src/ei/engine/scene/Node.java b/src/ei/engine/scene/Node.java index d65966e..e53fbe1 100644 --- a/src/ei/engine/scene/Node.java +++ b/src/ei/engine/scene/Node.java @@ -2,6 +2,8 @@ package ei.engine.scene; import java.util.ArrayList; +import org.lwjgl.opengl.GL11; + public class Node extends Sprite { /** the sprites of this node */ protected ArrayList entities; @@ -63,9 +65,23 @@ public class Node extends Sprite { * Draw all the Entities in the node */ public void render() { + // store the current model matrix + GL11.glPushMatrix(); + + //Sets the location + super.setTranslationGL(); + //the rotation + //super.setRotationGL(texture.getImageWidth()/2,texture.getImageHeight()/2); + //Sets the scale of the sprite + super.setScaleGL(); + for(int i=0; i