Categories
Corona SDK Lua News Solar2D Technology

Open source rebranding of Corona = Solar2D

 

Open source rebranding of Corona = Solar2D

After using Corona for 10+ years, it is still the easiest and most fun way to make apps and games. With a mature API and friendly programming language Lua, partly thanks to the original creator Walter Luh, Solar2D will continue to shine!

With the MIT license, Solar2D is finally 100% free. Free from splash screen, royalties, building from the server, and company policies. Anyone can also folk the source code and create whatever they want with it.

I’m available for developing apps and games with Solar2D for mobile, tablets, desktop, HTML and Apple TV. Team training will be considered as well.

Categories
Corona SDK Lua Solar2D Technology

Corona SDK -> Solar 2D

The BEST game / app development engine Corona SDK  is rebranded as Solar2D!

Solar2D is fully open source with the MIT license. It is simply the most mature and easy to use 2D game and application development engine available. Developing with Solar2D is much faster than any other SDK because of the simplicity and ease of use of the powerful API and Lua language.

Solar2D – Light Speed Development for Everyone!

Check out Solar2D.com!

Categories
Corona SDK Lua Others

What’s your favorite programming language now?

Having been programming since I was a teenager, I’ve used numerous programming languages on many different platforms over the years: from high-level languages to microcode, from general-purpose languages to task-specific ones, from languages suitable for graphics and multimedia to business and mobile applications.

One privilege of having my own company is I’ve worked on all sorts of projects with both tiny and huge companies, with individuals and large enterprise teams. This experience I gathered over the years has allowed me to understand projects and software development much better than if I were working at the same job and at the same company.

As this tech industry evolves (much quicker than many other industries), I have noticed that things repeat and the pattern is often similar. New technologies (languages, frameworks, tools, etc.) come along and people get excited. Then as these new technologies become more popular, people write books and talk about them in conferences. Soon more people jump on them, and they become bigger and more complicated, and code becomes harder to maintain, leading to more bugs… So, people start to look for something different again – something simpler.

It is interesting to hear one of the most famous game developers talk about his favorite programming language. John Romero, who founded id Software and created influential games that shaped modern-day 3D FPSs, told the audience his favorite programming language (YouTube link).

Incidentally, Lua is also my favorite programming language. It is easy to learn, simple, flexible and fast, no wonder it is used by many top games. The only disadvantage is that not many people realize how powerful Lua is, or they may look down on it because of its simplicity.

And here’s the recommendation that Romero gives for someone who wants to start making games: Use Corona SDK. It is Lua-based, free and open-source. Needless to say, Corona is my tool of choice ever since I first started using it when it became available around 2009.

Categories
Corona SDK Lua News

A new Corona

The day has arrived: Corona Enterprise is now free too!

Now it is just one Corona.

Integrating with native C/C++/Objective-C/Swift/Java code is now available to everyone. I’m sure a lot more developers will be developing native plugins that are sold (or for free) at the Corona Marketplace.

Corona and Lua are the best combination of simplicity, speed, stability, size, deployment choices, and community support for 2D games and app development. (No, I don’t get to paid to say this, I’m just a long-time user / developer.)

https://coronalabs.com/blog/2017/06/21/welcome-to-the-new-corona/

 

Categories
Corona SDK Lua Tutorials

UI data binding for Corona SDK

Here is a simple demo of data-binding to user-interface elements in Corona SDK. The purpose is to update variables so that UI elements (textfields in this demo) are updated automatically.

-- UI data binding demo for Corona SDK
--
-- Update variables and UI elements (textfields in this demo) are updated automatically
--
-- Created by:  Dave Yang / Quantumwave Interactive Inc.
-- Version:     1.00

-- place variables inside UIdata
local UIdata = {
    sum = 0,
    rand = -1,
}

-- create the UI elements
local sumTxt = display.newText( UIdata.sum, 150, 125, native.systemFont, 24 )
local randTxt = display.newText( UIdata.rand, 150, 250, native.systemFont, 24 )

-- bind the data to the UI elements
local UIdataBinding = {
    sum = sumTxt,
    rand = randTxt,
}

---------------------------------------------------------------------------

-- reference to the original UIdata table
local _uidata = UIdata

-- empty UIdata to make it work with the metatable below
UIdata = {}

-- the metatable defines what to do with access and change to data in UIdata
local UIdataMT = {
    __index = function(t,k)
        return _uidata[k]
    end,

    __newindex = function(t,k,v)
        -- changes to the data is updated in the textfield; other UI elements can be applied according to type
        UIdataBinding[tostring(k)].text = v
        -- update the original data
        _uidata[k] = v
    end
}

setmetatable(UIdata, UIdataMT)

-- single line if you prefer to replace the lines above starting from 'local UIdataMT = {'
--setmetatable(UIdata, {__index=function(t,k) return _uidata[k] end, __newindex=function(t,k,v) UIdataBinding[tostring(k)].text=v;_uidata[k]=v end})

---------------------------------------------------------------------------

-- change and access data

UIdata.sum = 42
print(UIdata.sum)

UIdata.rand = math.random(99)
print(UIdata.rand)

The latest updates can be found at github.

Categories
Corona SDK Lua OOP Tutorials

Simple demo of implementing Undo and Redo in Corona / Lua

Just posted a simple demo of HistoryStack, to show how Undo and Redo can be implemented in Corona SDK / Lua. It also demonstrates using EventDispatcher to dispatch events to update button states.

https://github.com/daveyang/HistoryStack

 

Categories
Corona SDK Lua News

ZeroBrane Studio updated to 0.90

The excellent ZeroBrane Studio for Lua development has been updated to 0.90, download it here or check out the source code at github.

This open source and free IDE is the best I’ve used for Lua / Corona SDK development. Support from the developer is also quick and excellent. What else can one ask for?

Update: Version 0.95 has been released.
Update: Version 1.00 has been released!

P.S. Check out this blog post for adding Corona SDK show reference.

Categories
Corona SDK Lua OOP

EventDispatcher docs

Documentation has been added for EventDispatcher in LDoc format, generated from the source file.

Here’s the basic usage:

local EvtD = require "EventDispatcher"

local dispatcher = EvtD()

-- listener as table
local listener = {
   eventName = function(event, ...)
      print(event.name, event.target, event.source)
   end
}

-- listener as function
local function listener(event, ...)
    print(event.name, event.target, event.source)
end

dispatcher:addEventListener( "eventName", listener ) -- or
dispatcher:on( "eventName", listener )

dispatcher:once( "eventName", listener )

dispatcher:hasEventListener( "eventName", listener )

dispatcher:dispatchEvent( { name="eventName" } ) -- or
dispatcher:dispatchEvent( "eventName" ) -- or
dispatcher:emit( { name="eventName" } ) -- or
dispatcher:emit( "eventName" )

dispatcher:removeEventListener( "eventName", listener )

dispatcher:removeAllListeners( "eventName" ) -- or
dispatcher:removeAllListeners()

dispatcher:printListeners()

All listeners receive the following fields in the parameter event table:

  • event.name (name of the event)
  • event.target (the listener itself)
  • event.source (the dispatcher)

Grab the latest code at Github.

Categories
Corona SDK Lua OOP

EventDispatcher update

Just a quick post that EventDispatcher has been updated with new features including new methods on(), emit(), once() that are similar to Node.js, a new method removeAllListeners(), and a debug function printListeners(). The on() and emit() methods are actually aliases to the addEventListener() and dispatchEvent() methods.

Chris Byerley (aka develephant) who developed Coronium.io and Coronium.gs is using EventDispatcher under the hood for the game server client code. Check out his projects if you’re a Lua / Corona developer.

Here’s the original post for EventDispatcher if you wish to read about it.

Grab the latest code at Github.

Categories
Corona SDK Lua Tips & Tricks

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:

 

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:

showreference = {
	target = 'http://docs.coronalabs.com/api/%s.html',
	transform = function(s)
		local tip = G.GetTipInfo(G.ide:GetEditor(), s)
		if tip then s = tip:match("%)%s*(%S+)") or s end
		s = (G.type(G[s]) == "function" and "global." or "")..s
		s = s..(s:find("[%.%:]") and "" or ".index")
		s = s:find("^_") and "type."..s:sub(2) or "library."..s
		return(s:gsub("[%.%:]","/"))
	end,
}

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