Pixel centres are where darkfrei said. For lines, line rectangles and polygons, it's generally better to use those. For rectangles and images (and anything rectangular) it's best to use integral dimensions.
Technically the left border is indeed 0, 0 but the right border is love.graphics.getWidth(), love.graphics.getHeight(). For collisions, which is what the OP was about, you usually have a rectangle-rectangle collision, and if you use 0 and love.graphics.getWidth() - 1 as left and right limits for the X coordinate respectively, there will be a 1 pixel line margin on the right.
Find top, bottom, left and right side of the window?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Find top, bottom, left and right side of the window?
This thread has everything: window coordinates, physics, a short essay on canvas scaling, pixel center coordinates, arrays (???), and where to render primitives.
To summarise the important information:
The left-top pixel in window coordinates is at 0, 0. The right-bottom pixel in window coordinates is at love.graphics.getWidth() - 1, love.graphics.getHeight() - 1.
The bounds encompassing the window area are 0, 0 (left, top) and love.graphics.getWidth(), love.graphics.getHeight() (right, bottom).
To summarise the important information:
The left-top pixel in window coordinates is at 0, 0. The right-bottom pixel in window coordinates is at love.graphics.getWidth() - 1, love.graphics.getHeight() - 1.
The bounds encompassing the window area are 0, 0 (left, top) and love.graphics.getWidth(), love.graphics.getHeight() (right, bottom).
Re: Find top, bottom, left and right side of the window?
If you draw the rectangle in "line", then it must be shifted at 0.5 pixel. The same for lines, as I know.
If you make a grid every 100 pixels in the window 800x600, then you can draw the lines at x=0, x=800, y=0, y=600 too.
Re: Find top, bottom, left and right side of the window?
Yeah, points, lines, and other primitives in 'line' mode. Those are the rasterizer rules, not the window coordinate rules. Window coordinates are integer. For example, a mouse cursor in the top-left corner of the window is at 0, 0. Not 0.5, 0.5.
I wouldn't count on your grid thing. Whether or not those lines are visible is a gamble and depends on GPU and drivers, and the selected line smoothing mode.
All of this is severely underdocumented in the wiki, and all examples are wrong.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 7 guests