2015年4月1日 星期三

[Corona SDK] The powerful editor - Sublime Text 2

There is no specified editor for Corona SDK.
You can use Notepad or UltraEdit if you want.
I would like to suggest the editor Sublime Text here sine it is quite suitable for coding Corona SDK program.
Let's see how to install it:

Step 1:
Please go the website Sublime Text to download the latest version.
Currently, the default version will be Sublime Text 2.
Of course, you can download Sublime Text 3 if you want.

After installing it, execute Sublime Text 2.

Step 2:
We need to let Sublime Text 2 to have the function of installing packages first.
Please press "Ctrl"+"`". Key "`" is located on the the left of key number 1.
You can also call the console menu from menu "View"/"Show Console".

Then, just paste the whole paragraph shown below:
import urllib2,os,hashlib; h = 'eb2297e1a458f27d836c04bb0cbaf282' + 'd0e7a3098092775ccb37ca9d6b2e4b7d'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler()) ); by = urllib2.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), 'wb' ).write(by) if dh == h else None; print('Error validating download (got %s instead of %s), please try manual install' % (dh, h) if dh != h else 'Please restart Sublime Text to finish installation')
The above paragraph is copied from https://packagecontrol.io/installation#st2.
If your version is not 2.0.2, you should go to the website again and copy it.

For Sublime Text 3, please go to website https://packagecontrol.io/installation#st3 to copy the related paragraph.
Paste it and then press Enter to execute it.
Reopen the  Sublime Text 2 after that.

Step 3:
Press key "Ctrl"+"Shift"+"P", or select menu item "Tools/Command Palette" to run the Command palette.
Input "Package Control: Install Package" and then press Enter.
The packages list will be shown up after few seconds.
Enter "Corona Editor".
Install it.....

Step 4:
If you install it successfully, you will find that one item "Corona SDK" is added.
We just go to item "Snippets" and select any function for testing.
For example, if we select "Snippets/Display/Image",it will add the following code in the program automatically.
display.newImage( [parent,], filename [,baseDir] [,x,y] [,isFullResolution] )

Step 5:
Open any ".lua" file.
Go to the menu item "Preferences/Color Scheme" to select your favorite color scheme.

Step 6:
When we open ".lua", press "Ctrl"+"B" or select the menu item "Tools/Build", it should call the "Corona Simulator" and run the result of that lua file.
In "Corona Simulator", if you want to go back to Sublime Text 2, you can press "Ctrl"+"Shift"+"B" or select menu item "File/Open in Editor".

沒有留言:

張貼留言