local sky = display.newRect( screenLeft, screenTop, screenWidth, screenHeight )
sky:setFillColor ( 0, 25, 111 )
And he gets the Rect in the center! I double checked everything and still getting the Rect fitted between the left upper conner and the center of the screen. Could you please explain why this happens? Thank you!
I see you got an answer to this on the community slack, but so the answer will be searchable and usable by others.
Many years ago (pre-2013) there were some inconsistencies in our API’s. for instance display.newImage() would center the object as would display.newCircle() and other API’s like display.newRect() would position using the top, left corner. When we released Graphics 2.0 in 2013, we made all of our API’s consistent, and now they all default to the center of the object for positioning.
You can either use the center of the object or if you want to use the top, left corner, you can use anchor points:
I see you got an answer to this on the community slack, but so the answer will be searchable and usable by others.
Many years ago (pre-2013) there were some inconsistencies in our API’s. for instance display.newImage() would center the object as would display.newCircle() and other API’s like display.newRect() would position using the top, left corner. When we released Graphics 2.0 in 2013, we made all of our API’s consistent, and now they all default to the center of the object for positioning.
You can either use the center of the object or if you want to use the top, left corner, you can use anchor points: