Codea iPad to Mac guide.  How to move your Codea files, app and project from Codea to xCode on your Mac.

Breaking News - click here!

This guide created on: 13 March 2013. It is based on Codea Runtime Library (BETA) 1.4.3. This Codea iPad to Mac guide is a memory guide for my own personal use, so you know it’s good.  If you find any mistakes or are stuck, leave a comment and I’ll do my best to help.

 

You will need and Getting Started:

  • Codea runtime library.  The link is listed below.
  • A Mac.
  • Codea iPad app.
  • iPad.
  • Xcode.
  • Terminal.
  • Email account to get the files out of your iPad.
  • Knowledge of how to use cd and cd .. in terminal.

Making the dummy project

First, download the Codea runtime files to your computer from https://github.com/TwoLivesLeft/Codea-Runtime.

Extract these Codea runtime files into a folder of your choice.  I use a folder called Codea in the Documents folder on my Mac.

Open terminal, move to the inside of the folder with the files you downloaded using cd .. and cd .

Type into terminal:
./make_project.sh NAMEOFYOURPROJECT

For example:
./make_project.sh Test

This will make a folder in the place where the make_project.sh file is located.

 

Import Your iPad Codea files to your Mac

Import the folder with all your .lua files in from the codea iPad app to your computer. You can copy and paste the text into individual .lua files manually or use a tool like iExplorer to dig in to your iPad. I use the manual method for security reasons.

Press and long hold your finger (about 3 seconds) on your app inside Codea on the main screen and it will show a menu with Delete, Duplicate and Copy.  choose copy.  This will copy all the code from your Codea app to the iPad clipboard.  You can then paste this into an email to yourself.  In the copied text each file inside your Codea project will be separated by a DASH DASH FILENAME.  Like –Main.lua.  Use this marker to split the file up again into individual files manually on your Mac.  Put all the files into a folder called Project.codea.

If you used the iExplorer method to get your files out, rename your imported folder to Project.codea.

If you are using a Dropbox spritepack folder copy that into the  spritepack folder you see in the xCode project.

 

Getting your Codea LUA files running on Mac

Install xcode from the Mac app store if you don’t have it.

Open the folder you made and double tap the file called CodeaTemplate.xcodeproj. It should open with xcode.

In xcode, on the left panel (the folder explorer panel basically), right click on and delete the folder called Project.codea in the Classes folder. When it asks choose the option MOVE TO TRASH.

Drag and drop this folder into xcode where the old Project.codea file was, which was in the Classes folder of the project.

It will show a popup. Select:
1. Copy items into destination folder’s group.
2. Create folder references for any added folders.
3. Lastly, make sure your app is selected in the big box.

 

Playing your Game if the Codea Dungeon game is showing

If you run the app now it will still show the dungeon game. We need to tell xcode that it should reload everything. To do this:

Open the file: Classes -> Supporting Files -> CodifyAppDelegate.m

Find and comment out the following 5 lines:
// NSString* oldVersion = [self versionForProjectAtPath:destPath];
// NSString* newVersion = [self versionForProjectAtPath:path];
//
// if ([oldVersion isEqualToString:newVersion])
// {
// return YES;
// }

You can now run your app by going to the top menu and choosing Product -> Run! or CMD + R.

 

If you get a black screen in xCode when running your Codea app:

Start again, but instead of using your own project run the project exactly as it is created by the make_project.sh file.  This will prove that the files are importing as expected and xCode is working.  Then we know it was your code that caused the black screen!

Now, make a new Project.codea folder.  Inside, make one file called Main.lua and put inside the code:

function setup()
displayMode(FULLSCREEN)
end

function draw()
background(100,100,100,255)
end

This is my code.  I know it works and it is what I used for testing.  Remember to comment out the five lines mentioned above before running it so it doesn’t just show the Dungeon game again.

This code simply changes the background to light black.  That’s the best I can do for troubleshooting.  If my code above worked then it’s a problem with your code somewhere.

If you found this guide useful, please leave a comment below with thanks.  If I get some thanks I’ll start making some more guides for making apps and games.

2 Responses to Codea Runtime iPad to Mac – Moving Files Codea to xCode

  1. skate_berlin says:

Leave a Reply

Your email address will not be published.


7 + = 15

Set your Twitter account name in your settings to use the TwitterBar Section.