hasen wrote: ↑Tue Feb 20, 2018 8:15 am
zorg wrote: ↑Tue Feb 20, 2018 7:57 am
rectangles are axis-aligned, as far as love.graphics.rectangle is concerned; you can only rotate those through the transform function love.graphics.rotate, which takes an angle in radians.
Ok I see. But love.graphics.rotate just takes one argument which is an angle, how would you tell it to rotate any particular rectangle? In the wiki it talks about rotating the screen so I assumed it was not for rotating individual shapes. Love.graphics.draw has an angle argument so rotating images is comparatively simple.
love.graphics.rotate rotates the coordinate system; if you translate that system to the centerpoint of any particular rectangle, rotate, then draw said rectangle, it will be drawn in the way you wanted it to be as; that said, after that's done, you need to reset the coordinate system.
In other words, you would either do what has been suggested above, or you could also wrap all that into a
love.graphics.push and
love.graphics.pop pair, since popping the rotation off the stack will also reset the coordinate system to the state before the first push.
hasen wrote: ↑Tue Feb 20, 2018 8:57 am
It says 'rotating a scene'. I doubt there would be so much code just to simply rotate a rectangle.
That said, if you'd use a mesh or just an image, you could use love.graphics.draw, which has its own transformation stack, hence you could just pass the rotation angle (and the center offsets) into that one function call. It's called OpenGL and it's called trade-offs (that the löve team decided when they implemented basic shape drawing as separate,
simpler functions)