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.
Drawing position of primitives, text, ect.
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Party member
- Posts: 215
- Joined: Sun Jan 18, 2009 8:03 pm
Re: Drawing position of primitives, text, ect.
Lower left corner of the first line.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).
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".I can see how the way circles are handled makes sense (but what about ovals?!) but the rest feels a but confusing.
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().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.
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: Ahrefs [Bot], Google [Bot] and 4 guests