This is an iPad app and since I don’t have an iPad local (my tester is remote), I like to test most things out on my phone. So the config.lua is a huge win for me as I don’t need to scale my stuff internally anymore!
My config.lua:
application = {
content = {
width = 768,
height = 1024,
scale = "zoomStretch",
},
}
I specifically set it to zoomStretch because I want to see/test the whole of the app and not miss anything, even if the graphics are little wonky due to the aspect ratio.
Everything works as expected except my background images. I have two of them, one for my “portrait” view and one for my “landscape” view. These are 768x1024 and 1024x768, respectively.
On my iPhone, they show up centered in the window (as they should), but they are about 50% of the background space… It’s like they get shrunk down twice.
The launch image is the same way (and the same resolution).
The same behavior is seen in all scale modes except none (for obvious reasons). All my other graphics are just fine and the scaling is all correct for dealing with mouse/finger interaction. So it’s related to the size of the image in some fashion.
My ISP is down tonite so I can’t upload any code, but it should be easy to reproduce some images (768x1024) to test it with.
[code]-- This is needed because in “portrait” orientation, you do not receive an orientation event
– on startup. I’m going to log this as a separate bug as it’s quite annoying when trying to find out
– what the starting orientation is…
_currentOrientation = “portrait”;
local function updateOrientation(delta)
local rot = {
portrait = 0,
landscapeLeft = 90,
portraitUpsideDown = 180,
landscapeRight = 270,
};
if (_currentOrientation == “portrait” or _currentOrientation == “portraitUpsideDown”) then
_bgNarrow.isVisible = true;
_bgWide.isVisible = false;
transition.to(_bgNarrow, {
time = 150,
rotation = rot[_currentOrientation],
x = 384,
y = 512,
});
else
_bgNarrow.isVisible = false;
_bgWide.isVisible = true;
transition.to(_bgWide, {
time = 150,
rotation = rot[_currentOrientation],
x = 384,
y = 512,
});
end
end
local function orientationHandler(event)
if (event.name == “orientation”) then
if (event.type == “portrait” or event.type == “portraitUpsideDown” or event.type == “landscapeLeft” or event.type == “landscapeRight”) then
_currentOrientation = event.type;
else
return;
end
updateOrientation(event.delta);
end
end
_bgNarrow = display.newImage(“bg-portrait.png”);
_bgWide = display.newImage(“bg-landscape.png”);
display.setStatusBar(display.HiddenStatusBar);
Runtime:addEventListener(“orientation”, orientationHandler);
updateOrienation(0);
[/code]
[import]uid: 5659 topic_id: 1006 reply_id: 301006[/import]
