Issues

Issue #567 wontfix

love.graphics.draw's should default to rotating around the center, not top-left corner

kikito
created an issue

I'm creating this issue because I believe that the most usual case when someone is drawing a rotated image is doing so around its center. Rotating around the top-left corner is something that happens very rarely, however it is the default behavior.

I hereby propose that on the next version of LÖVE, ox and oy default to "half-width" and "half-height" respectively. Reverting to the previous behaviour would be as simple as passing 0,0.

Probably it would help to have a getDimensions method available in all drawables first (#566)

Comments (4)

  1. vrld

    I am not sure this is a good idea, since ox and oy also define the drawing origin; so love.graphics.draw(img, 10,10) would place the upper left corner of img at 10 - img:getWidth()/2, 10 - img:getHeight()/2.

  2. kikito reporter

    Well, I propose that ox and oy are changed so that they only affect the rotation origin, and not the drawing origin.

  3. vrld

    Apart from implementation issues (which can be solved with a little thinking), I see two conceptional issues with this as well:

    • What if the lover wants the drawing origin to be at the center of the drawable? Especially with love.physics this might often be the case.
    • What is the meaning of x and y exactly when considering rotated or skewed drawables? The former upper left corner (i.e. the one that was upper left before applying the transformation)? Highly unintuitive. The upper left corner before applying the transformations? Less unintuitive, but still troubling with rotations not being multiples of 90°. The bounding box? Large computational overhead and different behavior with varying parameters.

    Maybe it's more useful to make the documentation less confusing/more explicit that ox and oy affect the drawing position as well as rotation, scaling and skewing center.

  4. Log in to comment