[Solved] Screen and window dimensions
Posted: Sat Jul 22, 2017 5:23 pm
The wiki states that top left corner in at ( 0; 0 ), however I need to use the following code to light up two pixels, one in the top left corner and the other in the bottom right corner.
This happens in fullscreen ('desktop' fullscreentype).
The same happens in windowed, where additionally the visible area is +1 px right than the drawable area.
Canvas behaves a little differently. Pixel positions are ( 0; 0 ) top left and bottom right is ( Canvas:getWidth()-1; Canvas:getHeight()-1 ) as expected. Yet I have noticed a thing that if you clear the canvas to a color of your choice, the colored area will be +1 px right and +1 px down than the area I can use to draw my two pixels, but I don't really mind this.
Later I checked the actual width of Canvas on a screenshot and the width is actually the same as I defined, which got me even more confused. It seems as if the Canvas was right size, yet the coordinates 0 to 49 (which is 50 possible values) are not as wide as 50 pixels.
The thing I wonder is if that's same for everybody or the screen/window dimensions/origins are kind of variable and what numbers should I use to draw in the corners then.
I belive that the logical origin for rotations is always ( 0; 0 ) though, it's just the graphics.
Thanks, plus I included my test source if you want to try.
Code: Select all
love.graphics.points(0, 1, love.graphics.getWidth()-1, love.graphics.getHeight())
The same happens in windowed, where additionally the visible area is +1 px right than the drawable area.
Canvas behaves a little differently. Pixel positions are ( 0; 0 ) top left and bottom right is ( Canvas:getWidth()-1; Canvas:getHeight()-1 ) as expected. Yet I have noticed a thing that if you clear the canvas to a color of your choice, the colored area will be +1 px right and +1 px down than the area I can use to draw my two pixels, but I don't really mind this.
Later I checked the actual width of Canvas on a screenshot and the width is actually the same as I defined, which got me even more confused. It seems as if the Canvas was right size, yet the coordinates 0 to 49 (which is 50 possible values) are not as wide as 50 pixels.
The thing I wonder is if that's same for everybody or the screen/window dimensions/origins are kind of variable and what numbers should I use to draw in the corners then.
I belive that the logical origin for rotations is always ( 0; 0 ) though, it's just the graphics.
Thanks, plus I included my test source if you want to try.