I’m getting a weird issue: My map consist to show 15x10 blocks on the screen at time (each block has 32x32 pixels, then the resolution needed is 480x320).
When I try to render the map, something happens, a black stripe is created on the bottom of the screen (some as iPad Mini the stripe is on right side), hiding the entire last row.
Example:

My config:
width = 320, height = 480, scale = "zoom", fps = 30
The code:
mte.loadTileSet("Tiles", "Tiles.png") mte.loadMap("maps/maptest.tmx") local camera = mte.setCamera({locX = 1, locY = 1, scale = 1}) mte.constrainCamera()
I noticed some phone viewers like iPhone 4 (640x960), Kindle Fire HD 7’ (800x1280) show the map correctly. What can I do to fit the map correctly on the screen?
Thanks!
I figured how to fix that just trying to get the aspect ratio and calculate how I need properly to scale X and Y axis regardless of mobile’s display.
Like I said before, I always want to exhibit 15x10 blocks and fit all of them at same time on screen:
Considering each block has 32 x 32 pixels I can do it:
local facScaleX = 1 local facScaleY = 1 local blockSizeX = display.actualContentWidth / 15 local blockSizeY = display.actualContentHeight / 10 if blockSizeX ~= 32 then facScaleX = display.actualContentWidth / 480 end if blockSizeY ~= 32 then facScaleY = display.actualContentHeight / 320 end local camera = mte.setCamera({locX = 1, locY = 1, scaleX = facScaleX, scaleY = facScaleY}) mte.constrainCamera()
This code works nicely if you set your project for “zoomEven” scale factor on config.lua.
But PLEASE I feel that as workaround so I’d like to see another solution and alternatives, maybe something that Works better, I don’t know.
I figured how to fix that just trying to get the aspect ratio and calculate how I need properly to scale X and Y axis regardless of mobile’s display.
Like I said before, I always want to exhibit 15x10 blocks and fit all of them at same time on screen:
Considering each block has 32 x 32 pixels I can do it:
local facScaleX = 1 local facScaleY = 1 local blockSizeX = display.actualContentWidth / 15 local blockSizeY = display.actualContentHeight / 10 if blockSizeX ~= 32 then facScaleX = display.actualContentWidth / 480 end if blockSizeY ~= 32 then facScaleY = display.actualContentHeight / 320 end local camera = mte.setCamera({locX = 1, locY = 1, scaleX = facScaleX, scaleY = facScaleY}) mte.constrainCamera()
This code works nicely if you set your project for “zoomEven” scale factor on config.lua.
But PLEASE I feel that as workaround so I’d like to see another solution and alternatives, maybe something that Works better, I don’t know.