How to scale a tilemap to always fit whole viewable screen?

Hi there,

I’m using Lime to render tiledmaps and I’m brand new on Corona and I’m trying to figure out how to scale a tile map to fit the viewable screen.

Checking on available tutus, the pretty basic settings for most cases is something like that:

config.lua

width = 320,   height = 480,   scale = "letterbox",   fps = 30

“letterbox” option for scalling means that all contente will be scalled to fit the screen preserving the same aspect ration. If I try to render a map with dimmensions that fit’s it (320x240) I have to do something like that: 15x10 and each tile frame with 32 pixels.

When I deploy the sample app for two android’s smart phones I’ve noticed a very tiny area between the right map edge and phone’s status bar that is not filled (completely black).

If I switch the phone viewers on Corona Simulator, the “gap area” is greater that others, but this is a simulation, dunno if the final render map gonna to be the same.

So, the problem may occurs because the scale mode selected, how can I ensure all drawable map gonna be render and fill all availabel area?

Thanks in advance.

Hi @suprasumomario,

When using letterbox mode, you still need to fill the “letterbox bars region” with some visual content. So, you should probably render your map at least one more row and column on all sides (perhaps even 2 more on each side).

Alternatively, you can use “zoomEven” mode which will fill the screen, but it will also push some visual content outside of the screen view on some devices.

Please read the guide to better understand the different modes:

http://docs.coronalabs.com/guide/basics/configSettings/index.html

Take care,

Brent

Thanks, Brent.

The map seems to be fill whole screen.

Hi @suprasumomario,

When using letterbox mode, you still need to fill the “letterbox bars region” with some visual content. So, you should probably render your map at least one more row and column on all sides (perhaps even 2 more on each side).

Alternatively, you can use “zoomEven” mode which will fill the screen, but it will also push some visual content outside of the screen view on some devices.

Please read the guide to better understand the different modes:

http://docs.coronalabs.com/guide/basics/configSettings/index.html

Take care,

Brent

Thanks, Brent.

The map seems to be fill whole screen.