Category Archives: NOOKcolor

Exploring Lua via Corona SDK

Last year I learned Lua as a new programming language. I got interested mainly due to its use as the primary programming language of the Corona SDK but also due to its use on other projects. Lua is used in World of Warcraft, Angry Birds, Adobe Lightroom and widely used within the gaming industry as a scripting engine atop a lower level 2d/3d graphics engine like OpenGL. Here is the basics from

Lua is a powerful, fast, lightweight, embeddable scripting language.

Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, runs by interpreting bytecode for a register-based virtual machine, and has automatic memory management with incremental garbage collection, making it ideal for configuration, scripting, and rapid prototyping.

Corona SDK provides a 2d graphics API using OpenGL ES combined with Lua for building applications targeting iOS ( iPad & iPhone), Android phones, and Android tablets like NOOKcolor (Android 2.1 API7). The SDK has evolved with developer feedback to include many native device features (accelerometer/camera/webview) combined with fully hardware accelerated graphics/text and integrated with APIs for including physics (Box2d) and social (Facebook/OpenFeint). Long story short is that it is a great SDK for creating graphical interactive applications and games. Productivity is where Corona
and Lua really shine. Here are some code to get you thinking:
Create a new image and add to displaylist:

myImage = display.newImage( "image.png")

Draw a square and place it within a group:

local rect = display.newRect(0, 0, 100,100) 
rect:setFillColor(140, 140, 140) 
local group = display.newGroup() group:insert( rect )

Create some images and apply physics to them:

local physics = require( "physics" )
local sky = display.newImage( "bkg_clouds.png" )
sky.x = 160; sky.y = 195
local ground = display.newImage( "ground.png" )
ground.x = 160; ground.y = 445
physics.addBody( ground, "static", { friction=0.5, bounce=0.3 } )
local crate = display.newImage( "crate.png" )
crate.x = 180; crate.y = -50; crate.rotation = 5
physics.addBody( crate, { density=3.0, friction=0.5, bounce=0.3 } )

NOOKcolor and Corona SDK work great together. On Android, Corona is built atop the NDK (Native Development Kit) with graphics rendered to either OpenGL ES
1.1 or 2.0 depending on device support. NOOKcolor ships with a great GPU supporting both OpenGL ES 1.1 & 2.0 and thus graphics performance really shines. Corona SDK makes building more reading centric applications and games easy targeting NOOKcolor and provides for a solid foundation for cross-device development. As part of my internal work I am building a photo viewer for NOOKcolor with Corona SDK that can import from Flickr and other image services. The SDK makes quick work of this task given the pliability of Lua as a language. As a language is a a close kin to silly putty and executes very fast. At first it feels like Flash 5 ActionScript 1 but slowly you will find a subtle quality that makes writing Lua very enjoyable. I strongly suggest you take a look at Lua and Corona SDK, the language and toolset are a great to learn, know, and apply to your next project.




In July of 2010, I was invited down to Palo Alto to meet some engineers from Barnes & Noble working on a stealth project. I was shown a 3 inch ARM motherboard, a 7″ touchscreen, all wired up in parts on a table, and running Android 2.1. The device was heavy on GPU with a solid 800Mhz CPU, 256MB RAM, and a great touchscreen. Even in parts on a table, this device had real potential given how thin all the parts were and a measured battery life of 20 hours. At this point the discussion turned toward the possibility of getting Adobe AIR and Flash Player running on the device. Interesting…

Over the next few months I worked closely with the team to get early engineering builds of AIR Android running on the device and testing applications to find strengths and weaknesses of the platform/device. In hindsight, it was the highlight of 2010 for me and the best project I had worked on in a very long time. It is one thing to work on pure cross-platform software but quite another to tweak the OS and hardware to make a better user experience. Things began to return to normal as I began working on Adobe MAX until I was contacted via LinkedIn via recruiter.

The key that really got me was the content strategy surrounding NOOK. The device would ship at a $249 price point and really focus on selling high quality books, interactive content, and applications leveraging touch. I have long felt that the next big market was interactive, I based the last 10 years of my career on it, but the opportunity to help deliver that on a first class device & brand was extremely tempting. It was essentially an extremely well funded start-up and a chance for me to work on a mass market console for interactive software. Sold!

I feel strongly that in 2011 we are going to see devices fully embrace the interactive medium in a big way. Somewhere between applications and static books is a great new medium waiting to be explored.

In regards to AIR/Flash on NOOKcolor, we will save that for another day.