At the moment my universal app runs one if statement at the beginning to choose which menu to load, from there there are a few shared functions (logic), however all the user interface ones are seperate functions.
so i have displaymenu() which links to displayscene1() and creditsmenu()
and displaymenuipad() which links to displayscene1ipad() and creditsmenuipad() functions.
for the resalution I have 2 image folders (images & imagesipad).
in your config.lua you specify the file suffix for the HD (retina) images and it automatically upscales them
so for example, I have images/menuBG.png & images/menuBG@2x.png - if its a retina (iphone4+ device) it will use the @2x image instead of the first one.
[lua]menuBG = display.newImageRect(“image/menu.png”,320,480) --[[will automatically use HD image (image/menu@2x.png and up-scale it to 640 x 960 --]][/lua]
Same applys for the iPad.
here is a paste from my config.lua
[lua]–config.lua
– coded while sleep deprived
– can be made half the size with an ‘if or’ statement!
local targetDevice = ( system.getInfo( “model” ) )
if targetDevice == “iPhone” then
application =
{
content =
{
width = 320,
height = 480,
scale = “letterbox”,
fps = 60,
antialias = true,
xalign = “center”,
yalign = “center”,
imageSuffix =
{
["@2x"] = 2,
},
},
}
elseif targetDevice == “iPhone Simulator” then
application =
{
content =
{
width = 320,
height = 480,
scale = “letterbox”,
fps = 60,
antialias = true,
xalign = “center”,
yalign = “center”,
imageSuffix =
{
["@2x"] = 2,
},
},
}
elseif targetDevice == “iPad” then
application =
{
content =
{
width = 768,
height = 1024,
scale = “letterbox”,
fps = 60,
antialias = true,
xalign = “center”,
yalign = “center”,
imageSuffix =
{
["@2x"] = 2,
},
},
}
elseif targetDevice == “iPad Simulator” then
application =
{
content =
{
width = 768,
height = 1024,
scale = “letterbox”,
fps = 60,
antialias = true,
xalign = “center”,
yalign = “center”,
imageSuffix =
{
["@2x"] = 2,
},
},
}
end[/lua] [import]uid: 62706 topic_id: 30180 reply_id: 120876[/import]