Weird positioning issue

Okay, I really feel stupid asking this, since this seems like a pretty simple thing to do. Working on my first tablet-only app, and designing for iPad layout.

This is the simple code in my project:

function displayCompanyLogo( event )  
 background = display.newRect( 0, 0, 768, 1024 )  
 background:setFillColor( 255, 255, 255 )  
 background:toBack()  
  
 backgroundImage = display.newImageRect( "company\_logo.png", 280, 220 )  
 backgroundImage.alpha = 0  
 backgroundImage.x = display.contentWidth/2  
 backgroundImage.y = display.contentHeight/2  
  
 companyGroup = display.newGroup()  
 companyGroup:insert(background)   
 companyGroup:insert(backgroundImage)   
end  
  
displayCompanyLogo()  

I have the Corona Project Manager project set to iPad.

This is what it looks like:

Why is that white rectangle positioning like that?

On another screen, I have the same background code as above and then a titleImage configured to Top Left:

titleImage = display.newImageRect( "program\_logo.png", 280, 220 )  
titleImage:setReferencePoint( display.TopLeftReferencePoint )  
titleImage.x = 20  
titleImage.y = 20  

That titleImage graphic is appearing positioned 20px in from the top and left of the white area.

Am I doing something wrong with defining that white background rectangle? Is this just a problem with the simulator?

I’ve tried setting the background to the TopLeftReferencePoint and CenterReferencePoint and it does the same thing.

I am using daily build 731, but I also tried stable build 704. Same thing on both.

So confused. Thanks for any direction you can provide. [import]uid: 17827 topic_id: 20943 reply_id: 320943[/import]

What "width"and “height” do you have setup in your config.lua?

If you say youre building only for iPad I think you would setup your config.lua to use the iPads display dimensions (w=768 / h=1024) because usually we set those numbers for 320x480,but as you say tablet only, would making these changes work?

Other thing is what kind of “scale” you`re using into the config.lua file.
Check those out and see what change.
Cheers,
Rodrigo. [import]uid: 89165 topic_id: 20943 reply_id: 82664[/import]

I’d be interested in knowing what Rodrigo has asked here as well - hopefully we can help you get this sorted out quickly :slight_smile:

Peach [import]uid: 52491 topic_id: 20943 reply_id: 82681[/import]

Hi. Try this

[code]
local _W = display.contentWidth
local _H = display.contentHeight

function displayCompanyLogo( event )
background = display.newRect( 0, 0, 768, 1024 )
background:setFillColor( 255, 255, 255 )
background.x = _W * 0.5
background.y = _H * 0.5
background:toBack()

backgroundImage = display.newImageRect( “company_logo.png”, 280, 220 )
backgroundImage.alpha = 0
backgroundImage.x = _W * 0.5
backgroundImage.y = _H * 0.5

companyGroup = display.newGroup()
companyGroup:insert(background)
companyGroup:insert(backgroundImage)
end

displayCompanyLogo()
[/code] [import]uid: 84637 topic_id: 20943 reply_id: 82800[/import]

Thanks everyone for the suggestions.

The config.lua is the following:

application =  
{  
 content =  
 {  
 width = 768,  
 height = 1024,  
 scale = "none"  
 },  
}  

The problem is now fixed though. Before I checked on here, I actually removed the CoronaSDK app and installed the 731 daily build clean. I also moved my project folder to a different location. And now it works. Not sure if something happened with Corona Project Manager or if I just had a bad install of the SDK app.

But it is working correctly now. Was just weird.

Thanks again for the suggestions. [import]uid: 17827 topic_id: 20943 reply_id: 82878[/import]

Hey - glad to hear you got this resolved. Thanks for providing follow up info, it may very well help others in the future :slight_smile:

Peach [import]uid: 52491 topic_id: 20943 reply_id: 82887[/import]