31 July 2015
From the Forum — Issue #83
Welcome to the latest installment of From the Forum. In this series, guest blogger Alex Jackson highlights outstanding threads from the Corona Forum. The goal is to bring attention to the most captivating, interesting, and thought-provoking discussions taking place in our very own backyard.
Please visit the forum to join these conversations or start your own!
1. Get that doc to the ones who need it
Take a step back into time today, we find a great discussion in the forums between a relatively new Corona developer and the CoronaLabs support contingent. Posing a question about moving downloaded images between app directories, I knew this was going to be a useful exchange that might yield a great link for the rest of the community.
What we got was a throwback to the halcyon days of 2013, and a tutorial link detailing how to move SQL databases within your Lua code. The nice thing about this, and this is something Corona support engineer Rob Miracle points out, the methodology can be applied virtually any file type. This way, the developer to move their downloaded files around, at will. I’m a pretty big fan of this since I’m always advocating for post-download asset handling, rather than bloating your app’s download size up front. Head over to the original thread and check it out!
2. High-level shaders made easier to manage
In recent weeks, the popular Corona Geek series has been discussing and evaluating shaders and how to apply them. If you’re not familiar, shaders calculate rendering effects on graphics hardware with a high degree of flexibility. They add some great texture to your app without a huge amount of overhead.
I’ve highlighted the forum post where some other Corona developers have shared their own shader code, but now, I wanted to bring in a forum post that talks you through the simple theory of shader implementation, and how simple ones can be designed. They are really cool to look at, and as you get better, you can get some pretty involved effects.
Check out the original thread to learn more about how to get shaders into your app now.
3. Detecting network status
When you’re checking for network connectivity to achieve the download functionality from the first tip, all good developers first check to see if the device being used actually has access to the internet. Handling this elegantly lets you provide a seamless experience to your users when they do use your app, instead of leaving the device to hang until everything you want is downloaded.
The way Corona developers can check for network connectivity, unfortunately, vary by device. Mac and iOS, conveniently, use the network.canDetectNetworkStatusChanges() API call to easily detect if your device actually can connect. On Android, however, you need to do a socket check.
I was able to find the below forum thread that displays a snippet for performing this check. Truck on down to the original post to read all about it.
Alex Jackson is an indie developer and the founder of Panc Interactive, specializing in retro-style gaming. He has created several mobile applications, enjoys long walks on the beach, pixel art, and reading the Corona forums. Contact him by email or follow him on Twitter: @pancinteractive. Check out his new game Segreta on iOS, Android, Windows Phone and Amazon devices.