## Drawing position of primitives, text, ect.

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Blart
Prole
Posts: 9
Joined: Sun Mar 01, 2009 7:42 pm

### Drawing position of primitives, text, ect.

The (x, y) coordinate you specify for drawing different primitives, text, and images seems rather inconsistent.

(x, y) specifies the upper-left corner of a rectangle. (x, y) specifies the center of a circle. (x, y) specifies the center of an image, unless you set the image's center manually. (x, y) specifies the bottom-left corner of a line of text (I haven't seen where wrapped text goes yet).

I can see how the way circles are handled makes sense (but what about ovals?!) but the rest feels a but confusing.

P.S. When drawing a line of text, what would I add to y to make it seem like I'm drawing from the top-left corner of the text? I tried adding the font size, but I'm not sure that's right or not.

osuf oboys
Party member
Posts: 215
Joined: Sun Jan 18, 2009 8:03 pm

### Re: Drawing position of primitives, text, ect.

Blart wrote:The (x, y) coordinate you specify for drawing different primitives, text, and images seems rather inconsistent.

(x, y) specifies the upper-left corner of a rectangle. (x, y) specifies the center of a circle. (x, y) specifies the center of an image, unless you set the image's center manually. (x, y) specifies the bottom-left corner of a line of text (I haven't seen where wrapped text goes yet).
Lower left corner of the first line.
I can see how the way circles are handled makes sense (but what about ovals?!) but the rest feels a but confusing.
The only two exceptions to the center rule are rectangles and text (unless I'm mistaken). For rectangles, I presume it makes sense for "pixel perfection".
P.S. When drawing a line of text, what would I add to y to make it seem like I'm drawing from the top-left corner of the text? I tried adding the font size, but I'm not sure that's right or not.
Subtract ...getFont():getHeight() from y. Also note that the distance the "same point" on two following lines of wrapped text is ...getFont():getHeight() * getFont():getLineHeight().
If I haven't written anything else, you may assume that my work is released under the LPC License - the LÖVE Community. See http://love2d.org/wiki/index.php?title=LPC_License.

### Who is online

Users browsing this forum: MerekiDor and 51 guests