I was wondering if anyone knew of a way to turn a Codea project into a single scene for Cocos2d, that can be accessed from another scene.
Being fairly new to Codea and Lua many questions I’ve already had were fairly simple and already answered by someone on these forums, but I haven’t been able to find a solution for this.
Any help would be much appreciated. Thanks.
You’d have to take all the parts of Codea and wrap them into a separate OpenGL view that you can run independently then transplant it into a cocos2d project. You’d have to use Cocos2D 2.0 because Codea uses OpenGL ES 2. It’s possible but would take quite a bit of work.
Would there be any way you could point me in the right direction on how to do that?
If you examine the Codea Runtime Library you’ll notice BasicRendererViewController. This class contains an EAGLView and draw loop, as well as script execution overhead and so on.
In order to have both Cocos and Codea draw into the same view, you would have to transplant Codea’s draw loop into a scene’s update mechanism - and the scripting setup into the scene’s construction. It would take a lot of messing around but I think it’s possible. Perhaps it’s something we should look at including so that Codea projects can easily be used as scenes in Cocos 2.0.
That’s something that I would really like to see. Particularly because of the ease-of-use with Cocos when it comes to scenes and menus. Using Codea for everything else and then being able to simply transfer that to a Cocos scene would be really useful in my opinion.