letterbox resolution question. i want a fixed height but variable width depending on aspect ratio

I’ve been using the modern config.lua with a base resolution of 480x320 and letterbox scaling.

The modern version recalculates width or height based on the aspect ratio. I want to change this so that I have a fixed height of 320 (never changes) and only have the width (480) recalculated to help with the aspect ratio. Having both the height and width change is limiting level design in my game.

Can someone let me know how this can be done?

Thanks.

orientation in config.lua is specified as if portrait orientation, so i think you’re actually asking for a fixed *width* of 320 right?  (then specifying landscape orientation in build.settings will rotate things making it your 320 *height* and 480-ish-variable width)

if so… just hardcode the 320 width and calculate your height based on device’s aspect ratio.  for example:

application = { content = { width = 320, height = math.floor(320 \* display.pixelHeight / display.pixelWidth), scale="letterBox", --etc

orientation in config.lua is specified as if portrait orientation, so i think you’re actually asking for a fixed *width* of 320 right?  (then specifying landscape orientation in build.settings will rotate things making it your 320 *height* and 480-ish-variable width)

if so… just hardcode the 320 width and calculate your height based on device’s aspect ratio.  for example:

application = { content = { width = 320, height = math.floor(320 \* display.pixelHeight / display.pixelWidth), scale="letterBox", --etc