1, Set the width/height to 320x480 in your config.lua
2, Add the imageSuffix params to the same file, it should now look something like this;
application =
{
content =
{
width = 320,
height = 480,
scale = "letterbox",
fps = 30,
imageSuffix = {
["@2x"] = 2,
}
}
}
3, For your background, make 2 sets of the same image, one 320x480px and the other 640x960px. Add the imageSuffix to the larger image (Menu1@2x.png) and the smaller without the @2x. Do the same thing with your button. I assume the background image cover the entire screen?
4, In your code use
local bg = display.newImageRect( "Menu1.png", 0, 0, 320, 480 )
-- For the button;
local Selectbutton1 = display.newImageRect( "Selectbutton1.png", xPos, yPos, buttonWidth, buttonHeight )
5, if you look at the files that came with the director.lua class, there should be a file named template.lua use that file as a reference or just copy the entire thing. At the bottom of the file there’s a cleanup function, either you remove all your objects there or in your code you posted add remove the button and the background in the changeScene function.
bg:removeSelf()
bg = nil
Selectbutton1:removeSelf()
Selectbutton1 = nil
6, Having 2 sets of images is not a must, but if you intend to make an app for iphone4 then it’s recommended otherwise the app wont look very “crisp” on Retina devices. Look how I set up the background image, I just set the width and height of the smaller image. The reason it is done is because the screen “estate” is still 320x480 on all iphone and ipods. On iphone4 and the new ipod the images get “scaled down” automatically because it has a higher ppi.
This might be a little confusing but there’s plenty of tutotials and blogposts about this or head over to Apple developer. Also read about it in the Corona docs.
The problem you had with the image was in the config.lua, width/height should be set to 320x480. [import]uid: 13560 topic_id: 13432 reply_id: 49338[/import]