diff --git a/log.txt b/log.txt index 0d3f635..b9e7a38 100644 --- a/log.txt +++ b/log.txt @@ -1,18 +1,26 @@ -2007-04-12 15:05:12:500 # Loading texture: data/map/sand.jpg -2007-04-12 15:05:13:015 # Loading texture: data/cursor/cursor.png -2007-04-12 15:05:13:203 # Loading texture: data/units/tank.png -2007-04-12 15:05:13:625 # Adding State: InGameState -2007-04-12 15:05:13:625 # Loading texture: data/loadbar_front.png -2007-04-12 15:05:13:734 # Loading texture: data/loadbar.png -2007-04-12 15:05:13:750 # Loading texture: data/loadbar_back.png -2007-04-12 15:05:13:765 # Adding State: LoadingState -2007-04-12 15:05:13:781 # Loading texture: data/splash.png -2007-04-12 15:05:14:531 # Adding State: SplashState -2007-04-12 15:05:14:531 # Enabling(true) State: SplashState -2007-04-12 15:05:20:968 # Removing State: SplashState -2007-04-12 15:05:20:968 # Enabling(true) State: LoadingState -2007-04-12 15:05:22:593 # Removing State: LoadingState -2007-04-12 15:05:22:593 # Enabling(true) State: InGameState -2007-04-12 15:05:24:562 # Moving: 2, 1 -2007-04-12 15:05:25:781 # Moving: 1, 1 -2007-04-12 15:05:26:234 # Moving: 4, 3 +2007-04-15 20:49:25:453 # Loading texture: data/map/sand.jpg +2007-04-15 20:49:26:796 # Loading texture: data/cursor/cursor.png +2007-04-15 20:49:27:203 # Loading texture: data/units/tank.png +2007-04-15 20:49:27:671 # Adding State: InGameState +2007-04-15 20:49:27:703 # Loading texture: data/loadbar_front.png +2007-04-15 20:49:27:843 # Loading texture: data/loadbar.png +2007-04-15 20:49:28:000 # Loading texture: data/loadbar_back.png +2007-04-15 20:49:28:015 # Adding State: LoadingState +2007-04-15 20:49:28:031 # Loading texture: data/splash.png +2007-04-15 20:49:28:875 # Adding State: SplashState +2007-04-15 20:49:28:875 # Enabling(true) State: SplashState +2007-04-15 20:49:35:390 # Removing State: SplashState +2007-04-15 20:49:35:390 # Enabling(true) State: LoadingState +2007-04-15 20:49:37:000 # Removing State: LoadingState +2007-04-15 20:49:37:000 # Enabling(true) State: InGameState +2007-04-15 20:49:45:515 # Selecting: 0, 0 +2007-04-15 20:49:46:937 # Moving: 2, 2 +2007-04-15 20:49:50:000 # Moving: 6, 5 +2007-04-15 20:49:55:687 # Moving: 9, 4 +2007-04-15 20:50:02:328 # Moving: 10, 1 +2007-04-15 20:50:05:828 # Moving: 0, 0 +2007-04-15 20:50:13:218 # Moving: 1, 1 +2007-04-15 20:50:17:125 # Moving: 2, 2 +2007-04-15 20:50:18:968 # Moving: 3, 3 +2007-04-15 20:50:20:734 # Moving: 4, 4 +2007-04-15 20:50:23:453 # Moving: 0, 0 diff --git a/src/ei/engine/effects/ProgressBar.java b/src/ei/engine/effects/ProgressBar.java index 23286cf..1b4a9d9 100644 --- a/src/ei/engine/effects/ProgressBar.java +++ b/src/ei/engine/effects/ProgressBar.java @@ -96,7 +96,7 @@ public class ProgressBar extends Entity{ } if(progress != null){ progress.setLocation(new Vector3f( - (LWJGLGameWindow.getWidth()/2)-progress.getWidth(), + (LWJGLGameWindow.getWidth()/2)-progress.getSize().getX(), (LWJGLGameWindow.getHeight()/2)+3,0.0f)); } if(background != null){ @@ -199,7 +199,7 @@ public class ProgressBar extends Entity{ if(background != null)background.render(); if(progress != null){ progress.setLocation(new Vector3f( - getLocation().getX()-progress.getWidth()+(progress.getWidth()*procent), + getLocation().getX()-progress.getSize().getX()+(progress.getSize().getX()*procent), getLocation().getY()+6,0.0f)); progress.render(); } diff --git a/src/ei/engine/scene/LineBox.java b/src/ei/engine/scene/Box.java similarity index 67% rename from src/ei/engine/scene/LineBox.java rename to src/ei/engine/scene/Box.java index 60b4e6a..17a4ac3 100644 --- a/src/ei/engine/scene/LineBox.java +++ b/src/ei/engine/scene/Box.java @@ -4,22 +4,25 @@ import java.awt.Rectangle; import org.lwjgl.opengl.GL11; +import ei.engine.math.Vector2f; import ei.engine.texture.Texture; import ei.engine.texture.TextureLoader; -public class LineBox extends Entity{ +public class Box extends Entity{ /** The texture that stores the image for this sprite */ private Texture texture; - + /** The size of this entity */ + private Vector2f size; /** * Create a new empty sprite * * @param window The window in which the sprite will be displayed * @param ref A reference to the image on which this sprite should be based */ - public LineBox(String name) { + public Box(String name) { super(name); - texture = new Texture(); + texture = new Texture(); + size = new Vector2f(); } /** @@ -28,9 +31,10 @@ public class LineBox extends Entity{ * @param name The name of the sprite * @param texture The texture to use */ - public LineBox(String name, Texture texture) { + public Box(String name, Texture texture) { super(name); - this.texture = texture; + this.texture = texture; + size = new Vector2f(texture.getImageWidth(),texture.getImageHeight()); } /** @@ -39,37 +43,33 @@ public class LineBox extends Entity{ * @param name The name of the sprite * @param ref A reference to the image on which this sprite should be based */ - public LineBox(String name, String ref) { + public Box(String name, String ref) { super(name); this.texture = TextureLoader.getTextureLoaderInstance().getTexture(ref); + size = new Vector2f(texture.getImageWidth(),texture.getImageHeight()); + } + + /** + * Returns a vector2f with the size + * + * @return a vector2f with the size + */ + public Vector2f getSize(){ + return size; } /** - * Get the width of this sprite in pixels + * Sets the size to the given values * - * @return The width of this sprite in pixels + * @param s A Vector2f with the size values */ - public int getWidth() { - if(texture == null){ - return 0; - } - return texture.getImageWidth(); + public void setSize(Vector2f s){ + size = s; } - - /** - * Get the height of this sprite in pixels - * - * @return The height of this sprite in pixels - */ - public int getHeight() { - if(texture == null){ - return 0; - } - return texture.getImageHeight(); - } - + /** * Returns the texture + * * @return The texture */ public Texture getTexture(){ @@ -87,7 +87,7 @@ public class LineBox extends Entity{ //Sets the location super.setTranslationGL(); //the rotation - super.setRotationGL(texture.getImageWidth()/2,texture.getImageHeight()/2); + super.setRotationGL(size.getX()/2,size.getY()/2); //Sets the scale of the sprite super.setScaleGL(); @@ -95,20 +95,20 @@ public class LineBox extends Entity{ texture.bindGL(); // draw a quad textured to match the sprite - GL11.glBegin(GL11.GL_LINES); + GL11.glBegin(GL11.GL_LINE_LOOP); { //Vertex at the upper left GL11.glTexCoord2f(0, 0); GL11.glVertex2f(0, 0); //Vertex at the down left GL11.glTexCoord2f(0, texture.getHeight()); - GL11.glVertex2f(0, texture.getImageHeight()); + GL11.glVertex2f(0, size.getY()); //Vertex at the upper right GL11.glTexCoord2f(texture.getWidth(), texture.getHeight()); - GL11.glVertex2f(texture.getImageWidth(),texture.getImageHeight()); + GL11.glVertex2f(size.getX(),size.getY()); //Vertex at the down right GL11.glTexCoord2f(texture.getWidth(), 0); - GL11.glVertex2f(texture.getImageWidth(),0); + GL11.glVertex2f(size.getX(),0); } GL11.glEnd(); diff --git a/src/ei/engine/scene/Node.java b/src/ei/engine/scene/Node.java index e53fbe1..a0a1267 100644 --- a/src/ei/engine/scene/Node.java +++ b/src/ei/engine/scene/Node.java @@ -76,7 +76,8 @@ public class Node extends Sprite { super.setScaleGL(); for(int i=0; i