Export to xcode: retina version uses non-retina sprites

Hey all,

So I’ve tried switching to the new export feature for iOS app testing instead of the Codea Runtime process. Everything worked fine except one critical issue: on my iPad2 everything was fine but on my brother’s iPad3 the app still used the non-retina graphics and everything was ultra small (1/2 size since they were non-retina images on a retina screen). I noticed the same behavior in the iPad Retina simulator. I’ve been looking for a solution but I haven’t found anything yet.

Any thoughts or help?


  • Mike

@Neztec do you define the size as a ratio of the width and height values or as the image size? If you use just the image size it will show up half the size, I’m pretty sure this was tackled before when Zoyt (I think) had the same issue…

Hey Luatee,

I’m not sure what you mean… are you asking about my meaning or how I literally implemented something? In my post I was saying the images were all scaled down to 50% of their intended sizes (and how they did look when I was using the Codea Runtime a while ago)… and the simple reason would be that the retina version of the app is trying to draw non-retina images. The ratio between height and width has been correct in all runnings of the app.

Did Zoyt have the same issue? I’ll look for his post.

Thanks for any help!

  • Mike

Anyone have any thoughts on this? I’m fairly stuck at the moment… I can see the @2x version of the images in my exported project in Xcode… why isn’t it using them?

  • Mike

U have the last version in ur iPad 2 ? @Neztec

A good question! I wasn’t on the latest, but I just upgraded (was 1 version behind I believe) and I did another export… same issue… are other people not seeing this issue? Is it because I’m doing this from an iPad2?

not think that’s it… it is stranger… @Neztec

I most recently tried adding @2x to the end of my sprite names… no dice. I can’t see to find any Codea core-code packaged in the Xcode project. Is there anywhere I can take a look and try figuring this out? I’m pretty stuck at the moment.

  • Mike

@Luatee - I’m rereading your first response… maybe that’s the answer… but when I draw a sprite I’m just doing sprite(“Dropbox:image.png”, 100, 200) … no size or ratio… as I understand you can only give width and height, no ratio. Right? What am I doing wrong?

  • Mike

well neztec, the problem is that retina display a 2 times bigger resolution, so the 100200 image will suddenly look like 50100

but what luatee meant is: do something like using WIDTH/(number)

then it takes the whole width of the screen
for example: non retina: 1000px
retina: 2000px

if you then divide it by let’s say, 10

then an image on non retina would be 100 wide, and on retina 200 (but looking like only
being 100px…)

does this answer your question?

So, just to clarify on Stevon’s last comment - I’m not even setting width, height, or location. Just sprite(“image.png”)… and I use translate to move to the right drawing location.

On the iPad everything looks correct. In the exported xCode version everything is being drawn in the correct location but is 50% smaller.

I tried modifying the lua code in xCode to draw a gray circle on top of everything, it is being drawn at the correct size. Only the sprites are getting halved. My gut says this must be something with the automatic retina vs non-retina graphics picking. Can anyone confirm this for me?

Really stuck - and I want to submit my game to a contest!

Any help is appreciated!

  • Mike

Hi. Sorry I missed this thread. Feel free to notify me by using the @ sign. I was a bit busy when this was posted. My issue was not quite this, but it might help fix this. There’s a variable called ContentScaleFactor. On non-retina devices it should be 1. On retina, it should be 2 or .5, I forget. I think it’s 2. Check to make sure that variable is different on retina devices. If not, try setting it manually (IDK if you can). If that doesn’t work, multiply each image size by it. Sorry if I’m not clear - I’m on an iPod.
P.S. What contest are you entering, if I may know… I assume it’s not Ludum Dare.

Thanks @Zoyt

So I think I found the issue. The xCode-export is, for some reason, packaging up the non-retina version of every sprite as both the non-retina AND retina versions in the zip file.

So in my dropbox:
image.png → 1024 x 768
image@2x.png → 2048 x 1536

In my exported Codea app w/dropbox sprite pack:
image.png → 1024 x 768
image@2x.png → 1024 x 768 (same image)

So this is definitely an issue, but I can fix it locally by just copying over my version of the graphics folder.

Hope this helps others. No idea why this is happening.

  • Mike

Please, just wait until Codea updates to officially support iOS 7 before exporting your app. Many things are broken currently, I believe the update will fix them.

Oh really? I had no idea. Thanks for the info.

And @Zoyt the contest that we’re entering is the Boston Indie Showcase for Pax East 2014… It’s a pretty big deal and I think we have a very good shot at it - if we can get recent problems sorted out.

I’m encountering some performance issues too. @SkyTheCoder or @Zoyt - any idea when the ios7 release will be out? My submission deadline is Jan 1 2014!

Thank you both!

@Neztec - I hope that it’ll be at least in beta by then. IDK about the public release. I hope it’s out by then. Right now I’m doing Ludum Dare. I’d kill to have an HTML5 Codea right now…

@Zoyt I didn’t have time for the ludum dare because I have a big math exam monday tommorow and another exam on tuesday

But much luck to you! I might participate in the next ludum dare

@Zoyt how are you handling distribution for LD? I’ve kind of shied away from trying as neither the App Store nor test flight seemed like good options.

@Mark Oh, two things just popped into my head. @Zoyt made a Codea iOS 7 mockup again, and this time used two things: AppCooker and AppTaster, which let you load .appcooker and .apptaster files to essentially run the app. I believe you can export the Xcode project into those files somehow so they can be ran on your iPad?

@Mark - I’m using Unity2D and the web player. But I’d love to be using Codea right now. I prefer handling objects myself and drawing them myself, not having objects managed by Unity.
@SkyTheCoder - AppCooker can’t export to Xcode. Apple restricted it. However, there are apps like Dapp and Interface 2 that export it for you. App Cooker is just up to date with iOS 7, so i used that.