Hi,
I’m trying to draw a full screen rectangle.
local bg=display.newRect(0,0,display.contentWidth,display.contentHeight)
However, instead of a full screen rectangle, i get this:
Hi,
I’m trying to draw a full screen rectangle.
local bg=display.newRect(0,0,display.contentWidth,display.contentHeight)
However, instead of a full screen rectangle, i get this:
That’s because the first 2 parameters of display.newRect now refers to the center of the rect, not the top left corner. So the size of the rect is correct, but it’s position is not.
If you want it to fill the screen then do either of these:
local bg=display.newRect(display.contentWidth \* 0.5,display.contentHeight \* 0.5,display.contentWidth,display.contentHeight) --or local bg=display.newRect(0,0,display.contentWidth,display.contentHeight) bg.anchorX, bg.anchorY = 0, 0
I tried both methods. Still same issue.
Your probably missing a config.lua file then, that sets your base content size etc.
Grab one from one of the Corona sample code projects to get you started
That’s because the first 2 parameters of display.newRect now refers to the center of the rect, not the top left corner. So the size of the rect is correct, but it’s position is not.
If you want it to fill the screen then do either of these:
local bg=display.newRect(display.contentWidth \* 0.5,display.contentHeight \* 0.5,display.contentWidth,display.contentHeight) --or local bg=display.newRect(0,0,display.contentWidth,display.contentHeight) bg.anchorX, bg.anchorY = 0, 0
I tried both methods. Still same issue.
Your probably missing a config.lua file then, that sets your base content size etc.
Grab one from one of the Corona sample code projects to get you started