Fixed Node rotation. (i think)

This commit is contained in:
Ziver Koc 2007-04-16 11:55:59 +00:00
parent 1cb10a3166
commit 380415f035

View file

@ -1,5 +1,6 @@
package ei.engine.scene;
import java.awt.Rectangle;
import java.util.ArrayList;
import org.lwjgl.opengl.GL11;
@ -76,7 +77,8 @@ public class Node extends Sprite {
//Sets the location
super.setTranslationGL();
//the rotation
//super.setRotationGL(texture.getImageWidth()/2,texture.getImageHeight()/2);
Rectangle rect = getBound();
super.setRotationGL(rect.width/2,rect.height/2);
//Sets the scale of the sprite
super.setScaleGL();
@ -112,4 +114,12 @@ public class Node extends Sprite {
}
return -1;
}
public Rectangle getBound(){
Rectangle rect = new Rectangle();
for(int i=0; i<entities.size() ;i++){
rect.add(entities.get(i).getBound());
}
return rect;
}
}