Corona SDK is an excellent option for any kind of mobile developer from beginner to advanced. This tutorial will introduce you to this easy-to-use cross-platform framework and show you how to start creating content for your preferred platform.
Related Corona SDK Tutorials:
- Introduction to Corona SDK: Easy Cross-Platform Development
- Corona SDK: Creating an Analog Clock App
- Corona SDK: Create an Accelerometer Driven Application
What is Corona SDK
The official Corona website describes the SDK as follows:
"Corona is a fast and easy development tool for iPhone, iPad and Android games and applications.
Corona-powered apps run at 30 fps in as little as 300k, and the graphics and animation engine fully leverages OpenGL hardware acceleration.
The Corona SDK is the first in Ansca's Corona family of products for creating high-performance multimedia graphically rich applications and games for the iPhone. With Corona, you can quickly create iPhone applications in a matter of hours. No Objective-C/Cocoa required, and no C++."
Ansca is the company behind Corona, and this SDK allows developers to create fast and powerful cross-platform applications that have access to API's other frameworks don't, like the camera, GPS and Accelerometer.
As mentioned before, Corona SDK offers plenty of features that make it a very reliable way to create applications. Some of these features are:
- Native Application Development: Corona executable binaries are 100% Objective-C/C++, so you won't have to worry about Apple iOS 4 new rules on using outside development tools. In fact, Corona needs Xcode to compile.
- Automatic OpenGL-ES Integration: No need to call extensive classes or functions to create simple screen manipulations.
- Cross-Platform Development: Corona can create apps for iOS (iPhone, iPod Touch, iPad) and Android devices.
- Performance: Corona is optimized to make use of hardware-accelerated features, resulting in powerful performance in games and apps.
- Device Features: Access device native controls and hardware, like camera, accelerometer, gps, etc.
- Easy to Learn: Corona uses the Lua programming language, which is powerful and easy to learn.
As Ansca is not officially a part of Apple or Android, there are certain things that may be not available in recent releases of the native SDKs. However, the people maintaining Corona are constantly adding new features as they become available. This is a problem for all cross-platform frameworks.
Some examples of features not yet supported in Corona include:
- Songs/Playlist Access
- Photo Libraries Access
- Custom Font Support
- Push Notifications
The largest advantage of Corona is that it allow you to work with one code base and produce products for many different devices.
Specifically, the Corona SDK will allow you to create apps for all iOS devices and Android devices.
Development with Lua
You can find out more about Lua on the official website.
Using Corona SDK
In order to use Corona SDK as your development environment you need the following:
- Mac OS X 10.5.6+ (If developing iPhone apps, an Intel based Mac is needed for testing and App Store submission)
- 1 GB RAM
- 50 MB of hard drive space
If you have a PPC based Mac, you can still create applications with Corona. However, you will only be able to test your apps in the Corona Simulator and won't be able to sell them in the App Store because Corona needs the latest version of Xcode to compile all iPhone applications.
Download Corona SDK
To start developing, go to the Corona SDK website and download a 30 day free trial.
At this time, Corona doesn't come with an exclusive Lua editor, but there are some great editors already available that you can use:
- Eclipse, using the Lua Eclipse plugin.
- LuaEdit, LuaEdit is an IDE/Debugger/Script Editor designed for the version 5.1 of Lua.
- NotePad++, a free source code editor which supports several programming languages, including Lua.
- TextWrangler, a powerful general purpose text editor and Unix and server administrator's tool.
- TextMate, Available for Mac OS X only.
- BBedit, a leading professional HTML and text editor for the Macintosh.
- Decoda, a professional development environment for debugging Lua scripts in your applications.
Creating Your First Program
To get started with Corona, let's begin with the classic Hello World application.
Open your prefered Lua editor and write the following code:
Create a new Project folder named HelloWorld and save the file as main.lua. We'll launch this app in the next steps.
If you come from a C like environment you will know that the print method outputs a string to the screen, you can test it by double clicking the Corona Terminal in the Corona application folder and selecting the HelloWorld project using the Open dialog.
This will also open the Corona Simulator displaying an iPhone graphic with no content, this is because the print function only outputs to the Terminal, to see how to display text in the simulator continue to the next step.
To access the simulator or actual device screen, we'll need to make use of the Corona specific API's.
In your main.lua file write the following and then run the program again:
local myTextField = display.newText("Hello World!", 1, 20, nil, 14);myTextField:setTextColor(255, 255, 255);
You have created your first iPhone/iPad/Android application using Corona SDK in just a few minutes! Of course, there's still a long run to go if you want to build great and high quality applications, so stick around for more updates!
Here are some additional links that will help you in the process of learning Corona:
- Programming in Lua - An excelent book on Lua Programming
- Learning Corona - The official Corona How To's
Corona is very powerful and easy to learn, and these facts make it an excellent way to start or continue your software development no matter what platform you are building for.
Thanks for reading this tutorial, I hope you've found it useful!
Subscribe below and we’ll send you a weekly email summary of all new Code tutorials. Never miss out on learning about the next big thing.Update me weekly
Envato Tuts+ tutorials are translated into other languages by our community members—you can be involved too!Translate this post