Codea Runtime Library

SimeonSimeon Admin Mod
edited April 2012 in General Posts: 5,404

Is now available on Github.

http://github.com/TwoLivesLeft/Codea-Runtime

Please let us know how you go with it. (Also much thanks to @Dylan for putting in a ton of work to make it easy to use and self-contained.)

«13

Comments

  • Posts: 25

    I think I speak for everyone here when I say, "WOOOOOO!" Great job!

  • Posts: 122

    Yeah, Thank you very much. This is going to be an interesting time for Codea and the iOS App store :)

  • SimeonSimeon Admin Mod
    Posts: 5,404

    You might want to keep your version of Codea Runtime Library up-to-date for the first few weeks as we'll be rapidly fixing bugs and incorporating changes.

  • Posts: 146

    Excellent! Thanks a lot! I will check it out as soon as I can make the time...

  • Posts: 3

    Yes this is so exciting! Thanks for all your hard work!

  • Posts: 2,820

    YES! Thank you! This is amazing! I can't wait to see what we do with this!

  • Posts: 384

    Congratulations TLL, I'm sure it will be a busy time ahead!

  • Posts: 76

    Can I run my Codea project on Mac instead of iPad?

  • Posts: 2,820

    I now believe that this is the gate to having more professionals using Codea because we can now sell out apps. I'll spread the word to real devs that are looking for good Xcode alternatives now.
    Thanks! :-D

  • SimeonSimeon Admin Mod
    Posts: 5,404

    @sanit you could do it through the iOS simulator. However to do it properly involves updating the runtime to be Mac OS X compatible. This is something we would very much like to do — and given that it's open source, others will be able to help out with.

  • Posts: 2,820

    Oh... And it's time to make a new section "Announce your app on the AppStore".

  • Posts: 2,161

    This almost makes me want a Mac again. Sadly, I can't join in with this unless I can persuade someone with a Mac (and an App Developer Account) to let me publish my code with them.

    But it's absolutely fantastic to have even the possibility. I do know some people with Macs.

    (Hmm, I wonder if running a Mac OSX emulator on Linux would be within the parameters of the Mac OSX licence given that the machine is actually an iBook, so it would be Apple software on an Apple machine, just with Linux in between.)

  • SimeonSimeon Admin Mod
    Posts: 5,404

    @Andrew_Stacey since OS X Leopard, the Mac OS X license has allowed virtualization. Mac OS X Lion allows 2 virtualized instances per machine — as long as the machine is Apple made.

  • Posts: 2,161

    Sadly, the last version of OSX that I own is Tiger (yes, I know it's old. So am I.)

  • edited April 2012 Posts: 159

    Stencyl (2D framework and IDE for flash / iOS / android and html5 coming soon) has a neat solution to the 'needing a Mac' issue, but I can imagine there must be a huge number of technical hurdles in implementing such a thing: if you're not on a Mac, you send them your code from within the IDE, they compile it on their server, and send you back a built app. That said, you do still need a Mac to do the final App Store submission.

    http://www.stencyl.com/stencyl/istencyl/

  • Posts: 176

    Why couldn't 2LL offer a service where for a fee they will do all the work for us? It would be cheaper for us and 2LL makes more money. Win-win. Only downside would be that 2LL would look like they created the app, and they may not want to do that. Support would be an issue, also. However, if they also charged for the app it might be worthwhile for them.

  • SimeonSimeon Admin Mod
    Posts: 5,404

    @jlslate I am not sure of the legal aspects of that situation. That is, whether Apple developer certificates and the signing process can be enacted on behalf of another person.

    By the way, to everyone using the Codea Runtime Library — you can actually target iPhone and build universal apps with it. Your WIDTH / HEIGHT variables will get set appropriately. I forgot to mention this.

  • Posts: 2,820

    You were featured on TUAW here: http://pulse.me/s/8zruw

  • SimeonSimeon Admin Mod
    Posts: 5,404

    I noticed that. Unfortunately Codea is described as running XML, and it makes it sound like we haven't released the runtime yet.

  • Posts: 176

    @Simeon - If there were to be a contract between the developer and 2LL that spelled out the relationship, then I would think it would be legal, just as a contract programmer would be able to write programs that you submit. But then again, I am no lawyer!

  • Posts: 65

    I think PhoneGap manage to do it but I could be wrong. And I have to admit that having buttons inside Codea to push a build out to TestFlight would be super sweet.
    Having said that I found it ridiculously easy to get my game onto my iPhone using the runtime engine. But then I don't have the problem of not owning a Mac OS.

  • Posts: 2,820

    @peteroyle - "And I have to admit that having buttons inside Codea to push a build out to TestFlight would be super sweet." - +10 , but that means having problems with app signing and such. IDK

  • Posts: 86

    I am having some problems with the Codea Runtime Library. I don't understand how to run the make_project.sh script from terminal. Every time I try it says "Codea Template: No such file or directory" Any help would be appreciated

  • edited April 2012 Posts: 65

    @Bieber208 are you running it from inside the Codea-Runtime directory? eg:

    git clone https://github.com/TwoLivesLeft/Codea-Runtime.git
    cd Codea-Runtime
    ./make_project.sh AngryPigs
    
  • Posts: 86

    I ran this. Where does it place the folder "AngryPigs"? I'm sorry, I'm new to Mac

  • Posts: 86

    Nvm, I got it. Thanks for the help!

  • Posts: 86

    @Simeon When I run my app, it does not work and the output box says "there is no draw function in Lua" How do I get function draw to work?

  • SimeonSimeon Admin Mod
    Posts: 5,404

    did you copy your Project.codea folder in as a folder reference (and not a group)? The icon folder icon must be blue in the Xcode files & folders section.

  • Posts: 505

    Works perfect! :)

    Crashed before I upgraded to iOS 5.1, don't know why, but now it works fine.

  • Posts: 86

    I copyed it into Classes like it says to

  • Posts: 86

    I even tried recreating with Codea Runtime Library. Is it possible that draw isn't supported by the Library?

  • SimeonSimeon Admin Mod
    edited April 2012 Posts: 5,404

    draw is supported. It sounds like the runtime can't find your project (and hence the draw function). This is a folder reference / group issue — you need to copy your project named Project.codea as a folder reference (so that it maintains the folder structure in the generated .app package).

  • Posts: 86

    I did that. I have tried recreating multiple times, following the instructions exactly. It still does not work

  • Posts: 86

    i figured it out. Turns out the problem was that i had two 'Main' files and so it got confused

  • Posts: 86

    I have another question. My program uses custom sprites from spritely. when i try to run it in Xcode it says "attempting to call global 'Spritely' (a nil value)" Does this mean that the global data can't be read and so it isnt loading anything? If so, how would i get it to work. It runs fine in Codea...

  • SimeonSimeon Admin Mod
    Posts: 5,404

    It sounds like you were saving images to global data with Spritely — these would only exist on your device. You would need to save them instead using saveProjectData and then ensure that the Data.plist file from your project is inside your Project.codea file.

  • Posts: 86

    So the default Spritely save function won't work?

  • SimeonSimeon Admin Mod
    Posts: 5,404

    I'd suggest using saveProjectData instead of saveGlobalData. This will generate a Data.plist in your project's bundle that you can move into the runtime project.

  • edited April 2012 Posts: 86

    The code for saving is this:

    SpritelyLoader = class()
    
    -- This very simple class takes data that's stored 
    -- in the Sprightly global variable, and transfers
    -- it to project data for your project. 
    
    -- For example:
    
    -- myLoader = SpritelyLoader("spritely")
    
    -- takes the image stored from the global SpritelyGlobal
    -- and adds it to your project data as "bob"
    
    -- Once in the project data, load the saved string to 
    -- an image using:
    -- createImage = loadstring( readProjectData("bob"))
    -- anImage = createImage() 
    
    function SpritelyLoader:init()
        local keys, k, s
        if readGlobalData("SpritelyKeys") == nil then
            print("No Spritely data found.")
        else
            -- read global keys
            keys = readGlobalData("SpritelyKeys")
            saveProjectData("SpritelyKeys", keys)
            print("Moving...")
            for k in string.gmatch(keys,"([^,]+)") do
                print(k)
                s = readGlobalData(k)
                saveProjectData(k, s)
            end
            print("Move complete.")
        end
        
    end
    
  • SimeonSimeon Admin Mod
    Posts: 5,404

    Your error sounds like you are trying to use a 'Spritely' class that is not defined.

    The code you posted looks okay. It should only touch global data if the SpritelyKeys exists.

  • Posts: 86

    What do you mean a Spritely class that's not defined?

  • Posts: 86

    Also, how would I get a button to stay in the upper right corner? I have a game where you move up but I want the button to stay fixed in the top right corner. Is this possible?

  • Posts: 1,807

    Hi Bieber208,

    Just a suggestion - call your routine for drawing the button last in the draw() function. Then it should overwrite whatever is there.

    This is assuming you haven't put any location parameters in the code which are updated as the app proceeds.

    Hope that helps.

    Bri_G

    :)

  • edited April 2012 Posts: 86

    I do have location parameters that update.... Is there another way to do it?

  • Posts: 86

    @Simeon
    When i run my app the output says
    "Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 2147483647 beyond bounds [0 .. 11]'
    *** First throw call stack:
    (0x33e1488f 0x32906259 0x33d5d9db 0x13f47b 0x16c869 0x13e16f 0x13df53 0x35a69e53 0x35a63985 0x35a31c6b 0x35a3170f 0x35a310e3 0x332e922b 0x33de8523 0x33de84c5 0x33de7313 0x33d6a4a5 0x33d6a36d 0x35a62a13 0x35a5fe7d 0x71393 0x71338)
    terminate called throwing an exception(gdb)"

    And it crashes.

  • edited April 2012 Posts: 176

    I'm stuck on step 3. Delete the existing the Project.codea file from the Classes group and select Move To Trash.
    I hate Xcode, and can't navigate it at all. That is why I like and use Codea. So how do I find this Project.codea file or the Classes group. There are so many views, and I have no idea where to start. Please be gentle! :)

    edit: Never mind. I just needed to click on the little triangle. No idea why that eluded me for so long!

  • Posts: 1

    Is there any way I can configure to use 64-bit floating point in the runtime?

  • Posts: 1,807

    Hi Bieber208,

    Any chance you can post the code relevant to your button and location calculations? May help us to identify your problem.

    Bri_G

    B-)

  • SimeonSimeon Admin Mod
    edited April 2012 Posts: 5,404

    @Joachim It's a #define in one of the Lua headers. However there may be some assumed floating point use (though there shouldn't be!) in the runtime.

  • Posts: 11

    Perhaps the FAQ thread should be updated - now it says that compiling App Store apps is "coming soon".

Sign In or Register to comment.