Fixed Node rotation. (i think)
This commit is contained in:
parent
1cb10a3166
commit
380415f035
1 changed files with 11 additions and 1 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
package ei.engine.scene;
|
package ei.engine.scene;
|
||||||
|
|
||||||
|
import java.awt.Rectangle;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
@ -76,7 +77,8 @@ public class Node extends Sprite {
|
||||||
//Sets the location
|
//Sets the location
|
||||||
super.setTranslationGL();
|
super.setTranslationGL();
|
||||||
//the rotation
|
//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
|
//Sets the scale of the sprite
|
||||||
super.setScaleGL();
|
super.setScaleGL();
|
||||||
|
|
||||||
|
|
@ -112,4 +114,12 @@ public class Node extends Sprite {
|
||||||
}
|
}
|
||||||
return -1;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue