It came to my attention that the 20px bar at the bottom of the Kindle Fire screen was included in the reported screen size, which results in display objects being partially hidden if they’re positioned at the bottom or too low.
I’ve come up with a solution that works well with dynamic scaling (letterbox) and also screen orientation changes.
What I do is scale the stage to take the bottom-bar into account, and shift the stage up.
Since the stage is uniformly scaled, I also recalculate the left/right visible screen coordinates accordingly.
Unfortunately I don’t have a Kindle Fire yet (living in Korea). So I’ve only been able to test this in the Corona simulator.
Here’s the code:
[lua]local deviceScreen =
{
left = display.screenOriginX,
top = display.screenOriginY,
right = display.contentWidth - display.screenOriginX,
bottom = display.contentHeight - display.screenOriginY
}
– kindle fire 20px bar-fix
if (system.getInfo(“model”) == “Kindle Fire”) then
local kFireScale = 580 / 600;
local stage = display.getCurrentStage();
local stageShift = 10 * display.contentScaleY; – shift the stage by half the bar height
local screenWidth = deviceScreen.right - deviceScreen.left;
local xShift = ((screenWidth / kFireScale) - screenWidth) / 2;
– shift stage up
stage:setReferencePoint(display.CenterReferencePoint);
stage:scale(kFireScale, kFireScale);
stage.yOrigin = stage.yOrigin - stageShift;
stage.yReference = stage.yReference + stageShift;
– adjust left and right visible coordinates
deviceScreen.left = deviceScreen.left - xShift;
deviceScreen.right = deviceScreen.right + xShift;
end[/lua] [import]uid: 70847 topic_id: 20490 reply_id: 320490[/import]
[import]uid: 50425 topic_id: 20490 reply_id: 82280[/import]