Corona Geek #111 – Texture Memory Management and Ultimate Config.lua Revisited

Corona Geek #111 – Texture Memory Management and Ultimate Config.lua Revisited

Corona Geek

During this week’s Corona Geek Hangout, Corona Ambassador Ed Maurina shared texture memory management tips for freeing up texture memory when you have to display and retain many hundreds to thousands of images on and off-screen. Also Corona Ambassador Sergey Lerg shared his config.lua solution for scaling content to fit the most common screen sizes, including iPhone 6 and 6 Plus.

Compete In The “Geek Games”

Remember to put your gaming skills to go use. Post your 2048 Hex high score to the Corona Geek Facebook wall for a chance to win a $50 gift card to a retailer of your choice! Multiple entries are allowed. Post each time you get a new high score. A winner will be announced on November 3rd. We’ll remind you throughout the month. Good luck!

Replay Last Week’s Show


Thank you for listening to and following Corona Geek:

Charles McKeever

Charles McKeever is a life long computer geek who enjoys exploring technologies to understand how they work, how they can be smashed together, and how they can be used to fuel entrepreneurial endeavors.

  • Marcotronic
    Posted at 00:21h, 14 October

    Thanks a lot for this video! Your ultimate config.lua looks very good and I really like the idea. I’m wondering now, though, how to deal with it when actually designing graphics. Let’s say I want to create the “ultimate” background image in Photoshop: Which perfect “main area” without potential bleed would I have to design (width, height) – the area that will definitely be visible on each and every device and how much additional bleed in pixels would I have to add (width, height) – to make sure every potential device won’t have any letterboxing borders.

    I want to create some photoshop templates with guides for “safe” areas and bleeding areas at a maximum resolution and create some actions to scale this image down to lower resolutions that may be needed. I would happily share this photoshop template and the photoshop actions if I knew what the “perfect” solution looked like 🙂


    • Lerg
      Posted at 21:35h, 14 October

      Hi, thank you!

      Regarding background image, take the most ridiculous android device with resolution 400×854 and put it into the trash, targeting such devices is a waste of time. Now take a reasonable most wide android device 480×854 – aspect ratio is 1.77916, which is just a little bigger than for iPhone 6 – 1.7786. Take a safe 1.78 aspect ratio.

      Now that you are certain with aspect ratio, you can create any image with such width and height and it will cover all devices when properly scaled (“zoom even” scale).

      Now take the highest resolution with highest height (let’s assume you are making a landscape app). That is 1600×2560. Now you have height (1600), you have aspect ratio 1.78, you can calculate the width:
      1600 * 1.78 = 2848, which is perfect, because it can be divided by 8 with no remainder (2848 / 8 = 356).

      That’s it, you have 1600×2848 scalable background@4x that covers all devices using zoom even method:
      local s = _H / bg.height
      bg:scale(s, s)

      If you don’t scale, your background will be pixel perfect when available, but will have smaller safe zone.

  • Michael
    Posted at 10:50h, 14 October

    a big thank you to Sergey for his fantastic config.lua. this will make it simple to handle the different devices and there resolutions. cool idea!

    • Lerg
      Posted at 21:36h, 14 October

      You are welcome!

      • Michael
        Posted at 08:43h, 19 October

        works perfect for my sprites and co, but unfortunately it will not solve the problem with background pictures and the different sizes on different devices…

  • Lerg
    Posted at 21:36h, 14 October

    On a side note, I realized I should have given this config lua file a distinct name. Any suggestions for the name?
    Look like “the best config.lua” or “awesome config.lua” are not working.

Post A Comment