ZeroBrane Studio

For Lua development, whether it is for plain Lua or platforms such as Corona SDK, ZeroBrane Studio is an excellent open-source IDE (written in Lua) for Windows, Mac OS and Linux. I still use Sublime Text with the Corona Editor plugin but ZeroBrane Studio is my first choice for Lua development.

This IDE is updated frequently and has great support from Paul Kulchenko. To grab the latest update before a new version is released, download from the github page, and follow these steps on Mac OS:

  1. Locate ZeroBraneStudio.app in the Applications folder
  2. Right-click on the app and choose Show Package Contents
  3. Open the Contents folder, and then the ZeroBraneStudio folder
  4. Drag and drop everything(*) inside the (github) ZeroBraneStudio folder into the above folder inside the app

* Actually not all files are needed, see an example of files and folders to drag over in the following image:

ZeroBraneStudio

If you have made changes to a theme or configuration (such as tomorrow.lua in the cfg folder), make sure you have a backup copy before replacing everything as described above.

Download the IDE here: http://studio.zerobrane.com

To show Corona SDK reference from right-clicking on a keyword in the editor, add the following code to the end of your user settings (user.lua) found under the Edit | Preferences menu:

Add showreference.lua from ZeroBranePackage to the ~/.zbstudio folder if it’s not there already. Quit and relaunch the IDE to see the update.

Share this: Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInEmail this to someoneShare on RedditPin on PinterestShare on Tumblr

Send custom events with EventDispatcher for Corona SDK / Lua

In Corona SDK, event listeners can only be added to the global Runtime object or to display objects. In order to broadcast messages to event listeners, the event dispatcher is limited to either one or the other. This limitation places messaging in the two scopes instead of between objects that are supposed to be talking to each other. I’ve seen many examples with display objects that are created solely for the purpose of dispatching events. This just doesn’t feel right to me; so I’m releasing my EventDispatcher, perhaps other developers may find it useful too.

Those who came from the good old Flash 5 days may remember FLEM (FLash Event Model). It was the first listener event model for Flash and ActionScript, and was created by Branden Hall and further developed and maintained by me. I’ve adapted the basic event model mechanism found in ActionScript 2/3 to Lua. This EventDispatcher has a similar interface as the listener model in Corona SDK, with some extra features thrown in (such as optional extra parameters when dispatching events, and returning status).

EventDispatcher provides custom event broadcaster/listener mechanism to regular Lua objects, it works as regular Lua 5.1 / 5.2 code, in Corona SDK, and likely other Lua-based frameworks.

Basic usage:

Sample code below demonstrates how it can be used:

Here is the output from the code:

iPad is turned off by Artist2 (table)
Artist2 is resting
Rested 1
Cowboy1 is drawing a gun
Cowboy2 is drawing a gun
Artist1 is drawing a picture
iPad is turned on by Artist2 (function)
Artist2 is drawing on the iPad
Removed
iPad is turned off by Artist2 (table)
Artist2 is resting
Artist1 is resting
iPad is turned off by Artist1 (table)
Rested 2
Cowboy2 is drawing a gun and shooting a bandit
iPad is turned on by Artist2 (function)
Artist2 is drawing a bandit on the iPad
Mayor collected 42 pieces of gold from Dave

And here is the EventDispatcher module:

Update (Sept 12, 2014): Added aliases ‘on’ and ‘emit’ for ‘addEventListener’ and ‘dispatchEvent’ for Coronium GS.

EventDispatcher provides a broadcaster/listener event mechanism to regular Lua objects. Corona developers can write cleaner object-oriented messaging code that doesn’t rely on display objects or send messages from the global Runtime.

For the latest code, check out EventDispatcher at github.

Share this: Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInEmail this to someoneShare on RedditPin on PinterestShare on Tumblr

Lua table remove by key

Lua has a table.remove() function that deletes an element from a table at the specified position, or the last element by default. However, it doesn’t work when the table is an associative array (e.g. {name=”swfoo”, domain=”swfoo.com”} ).

Below is a simple function that deletes a key-value pair from a table. One important feature to note is that instead of modifying the original table, it returns a new table.

Share this: Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInEmail this to someoneShare on RedditPin on PinterestShare on Tumblr

A mighty PNG

This innocent-looking PNG image makes a huge difference to iOS apps if you need to target retina display devices. At 640×1136 and named “Default-568h@2x.png”, this default launch image tells the app to run in full retina resolution on devices such as iPhone 5. What’s different with this image is the tiny file size of only 184 bytes. You’re welcome to grab it and use it.

Default-568h@2x.png

Share this: Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInEmail this to someoneShare on RedditPin on PinterestShare on Tumblr

Develop and publish mobile apps for free

Corona Labs announced a completely free version of Corona SDK for developing and publishing mobile apps and games. This is great news for anyone who wants to create apps without paying a single cent. Students, indie developers and hobbyists would benefit most from this announcement.

What’s the catch? Well, there really isn’t one, except the new Starter version does everything the Pro version did, minus these three features: In-app purchases, analytics, and access to daily builds. Corona Labs doesn’t even require their splash screen to be displayed like some other “free” SDKs. A developer can use the Starter version to make apps and earn money by either charging up-front, using ads, or other means.

You’re probably thinking why would Corona Labs make this move. The reason is simple: Attract more developers to their platform (SDK and Corona Cloud). If developers feel the need for the three features and upcoming “pro” features, they would upgrade to the Pro version. Some pro features Corona Labs mentioned they’re working on include: new graphic features using OpenGL 2.0, plugins, device access through native code (maybe, but not full-blown like the Enterprise edition).

For existing developers with Indie subscription, they’re now automatically upgraded to the Pro version. For Pro subscribers, they get two extra months of subscription. For Enterprise subscribers, there’s no change.

There is, however, a price increase for the Pro version starting May 1st, 2013 from $349 to $599 per year. For pro subscribers, as long as their subscriptions are not expired by April 30th, they can upgrade twice at the old price of $349. For anyone who wants to take advantage of the lower price (for the next two years), subscribe by April 30th! More info at their pricing page and the conversation with their COO.

As a side note, Corona Cloud is an exciting server solution for any developer (not just Corona developers) who needs features such as User accounts & authentication, Leaderboards & Achievements, Multiplayer, Push Notifications, Social Connect, Cloud Sync, Chat, News, and Analytics. This simplifies greatly dealing with the server from a developer’s point-of-view.

For those who are interested, Walter Luh (CEO of Corona Labs), will be coming to FITC Toronto this month. His presentation is Building Native Apps: A Digital Canvas for Coders and Designers.

Off to making apps that people love…

Share this: Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInEmail this to someoneShare on RedditPin on PinterestShare on Tumblr

Painting on iPad (with Procreate and Sensu brush)

Tablets are becoming productive tools and not just for media consumption. Back in the days of the Amiga, I had a Wacom tablet; it worked well but the drawing programs were quite primitive. Today, with tablets and many decent drawing and painting apps, artists can be creative wherever they go.

Procreate is an amazing painting app for the iPad, with features found in professional software, and costs only $4.99. This may seem expensive to some, considering many apps are free. However, this is probably the best $4.99 I’ve spent on apps. Today, version 1.7 is released, and it adds at least two new features that I was hoping for: full-screen mode and 4K resolution. Together with the Sensu brush, even my parents feel comfortable painting on the iPad.Procreate

The Sensu brush looks like a traditional artist brush, with special brush hair on one end that works with capacitive touch screens, and a rubber tip on the other as a regular stylus. It feels balanced, comfortable, and at the right length.

Sensu brush

Another similar but simpler app I like is Paper. It’s for drawing or writing notes, and is free. In the free version, there is only a single pen tool and a limited number of colors. With in-app purchases, additional tools and a color mixer can be added for about $9, which is a little high for a simple app like this. But then, it’s the simplicity that’s the beauty of this app. With Paper and the lighter iPad mini, I can see this combination as an everyday notepad for jotting down ideas and sketches.

Last but not least, the Pogo Connect is a much talked-about pressure sensitive Bluetooth stylus. Both Procreate and Paper support it. I have yet to try it as the cost ($80) is higher than the other pens, especially for casual drawing.

Using the iPad as a creative tool for artists is becoming a reality with these apps and styluses (styli). As we’re moving away from the PC era, tablets already fulfill the needs of most people. As a new media software developer, working on a computer with a real keyboard is still the only choice. I can’t wait to see what the next generation of software development tools will be like. And no, I don’t think Siri is the answer. :)

 

Share this: Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInEmail this to someoneShare on RedditPin on PinterestShare on Tumblr