Codea integration with xcode

Has anybody put steps together to integrate a codea app with an existing app? I have an app that I could leverage codea to some flare to it. Basically I’m looking to touch a button to launch the codea script seemenly on another form/xib. Then another button causes another codea script to run, not even related…

@wrmichael - this is exactly what the new add on functionality provides. You can use it to call objective c code from lua and vice versa.

Have a look at this audio add on tute (http://codeatuts.blogspot.com.au/2013/04/tutorial-28-codea-v152-objective-c-add.html) to see how it is done. If you get stuck let me know.

@wrmichael actually you can do it the other way around, too. Just present the CodeaViewController as you would any other view controller.

@Simeon
If my app is ipad/iPhone can I till use the codea engine if I only call it from the ipad?

If only use iPhone screen size would it work for iPhone.

I’m finishing up my first simple attempt.

If I have ARC enable is that going to kill the deal. (Because I do).

@wrmichael I just built a universal app using Codea on the iPad. I tried a couple of approaches. One, you can set up a scale based on screen percentages instead of pixels. This works, but I found the difference in screen ratios caused problems. Instead, I mapped WIDTH and HEIGHT to variables and ran all sprite and text call past a scaling factor.

When testing in Codea, remember to use 320 by 480 and 320 by 568 for iPhone screen sizes. Because of pixel density, the screen size on an iPad will end up pretty well matching the physical size ion an iPhone.

@wrmichael you can use it on iPhone and iPad. The WIDTH and HEIGHT globals in your scripts will be set appropriately.

@wrmichael - your exported project will work with ARC enabled.

Great! Sounds like everything has been taken care of.

Testing the universal version of ScramWords on an iPad.

It does a pretty decent job of mimicking the iPhone experience.

I published the app as a stand alone. I’ll integrate later.

  1. iPod version sucks! My fault I’m sure. My text objects don’t correctly accept touches meaning that they are out range and it still triggers the selection.

  2. I need to figure out the hooks for custom mp3 files. I think I saw notes earlier

It would be really cool if the engine could just scale the size based on device.

Since it can’t do we check for device by checking for the value of width and height?

@wrmichael - you can use the following macros in Objective C to determine device type.

#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_IPHONE_5 (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 568.0f)
#define IS_IPHONE_4 (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 480.0f)