When a WidgetSprite is rotated which has its size set manually by using setWidth() and setHeight() it gives unexpected result. If the size is set to (0, 0) then the rotation works as expected.
Below is the sample code:
WidgetSprite sprite;
int init()
{
Gui gui = engine.getGui();
sprite = new WidgetSprite(gui,"samples/widgets/textures/background.png");
sprite.setPosition(400, 300);
// Uncomment to see the problem.
//sprite.setWidth(128);
//sprite.setHeight(128);
gui.addChild(sprite, GUI_ALIGN_OVERLAP);
return 1;
}
float fAngle = 1.0f;
int update()
{
sprite.setTransform(rotateZ(fAngle));
fAngle += 0.1;
return 1;
}
int shutdown()
{
delete sprite;
return 1;
}