Config.lua for a pixelated game

Hello,

Currently I am struggling getting my config.lua correct

Our game is using an pixelated look, so I set the magTextureFilter and minTextureFilter of the global display object to “nearest” (so it uses nearest neighbor scaling) and is always displayed in landscape mode

I want that only the aspect ratio will matter on how much the player can see, I’ll use this table below as a reference

4:3 320×240 Android devices 1024×768 iPad 1, iPad 2 2048×1536 iPad 3 3:2 480×320 iPhone 3GS and lower, Android devices 960×640 iPhone 4, iPhone 4S 16:10 800×480 Android devices, WindowsPhone7 1280×800 Android tablets like Google Nexus 7, Samsung Galaxy Tab 10.1, Motorola Xoom, Asus Eee Pad Transformer 17:10 1024×600 Android tablets like Samsung Galaxy Tab 7 16:9 640×360 Symbian3 devices like Nokia C7 854×480 Android devices, MeeGo N9 1136×640 iPhone 5

I wanna keep the height (in landscape mode) as a constant

This would mean 4:3 devices will see the least amount of space and 16:9 the most. Because the width increases and the height is kept as a constant

See the attached image, the player will in every device see 3 balls height, but the view area changes when the device gets other aspect ratios

I dont need the use of high resolution images as everything is scaled pixelated, is there any simple way I need to configure my config.lua to achieve this?

For example I would like the code to act the height is always 160px and the width is variable

There are two different ways to go about this.  One is to have a fixed content area:

application = {
       content = {

            width = 320,

            height = 480,

            scale = “letterbox”,

            xAlign = “left”,

       }

}

With this config.lua, your content area will always be 320 high and 480 wide and it will be anchored to the left side of the screen.  While display.contentWidth will return 480, display.actualContentWidth will return the real width of the screen based on this scale factor.  That is an iPhone 5 will return 568 (since you’re a landscape app and config.lua’s are always done in “Portrait”.

The other way is to have your config.lua calculate the the height, but the only benefit from this would be to make your display.contentWidth be the right edge of the screen.  But you can use display.actualContentWidth and accomplish the same thing.

Rob

There are two different ways to go about this.  One is to have a fixed content area:

application = {
       content = {

            width = 320,

            height = 480,

            scale = “letterbox”,

            xAlign = “left”,

       }

}

With this config.lua, your content area will always be 320 high and 480 wide and it will be anchored to the left side of the screen.  While display.contentWidth will return 480, display.actualContentWidth will return the real width of the screen based on this scale factor.  That is an iPhone 5 will return 568 (since you’re a landscape app and config.lua’s are always done in “Portrait”.

The other way is to have your config.lua calculate the the height, but the only benefit from this would be to make your display.contentWidth be the right edge of the screen.  But you can use display.actualContentWidth and accomplish the same thing.

Rob