I've modified the movieclip library to use the retina display!

Here ya guys go! I’ve done it! You can now use the movieclip library while supporting multiresolutions! How does this work? Well first make sure your config.lua has this tag in it:

 imageSuffix =  
 {  
 ["@2x"] = 2,  
 },  

Then make copies of all your images and make the low res look like: “mysprite.png” but the high res look like “mysprite@2x.png”. And to call the graphic you need to use newImageRect instead of newImage. But after doing this I had a few problems… one of the biggest problems was the fact that I couldn’t use the movieclip library with my retina display graphics, so I had a gander in the code and I’ve modified it!

Download and link my movieclip library to your file rather than the default one (maybe the developers will add my library to the official source instead of the existing one?)

Here’s the download for it: http://www.2shared.com/file/M_0ukVLY/movieclip.html
To use, you use much like the original movie clip library, except you add width and height to it like so:

char = movieclip.newAnim({ "frame001.png",  
 "frame002.png", },width,height)  

Obviously you replace width/height with the values of the low res graphic (don’t worry, the tag in the config file will double the size if it’s a retina display)
I hope you guys can benefit from this! Maybe we can get the devs to add this to the official code :wink: I wish for more support of retina displays, I’ll wish I could get my hands on the sprite sheet code so I can recode that one to work too :slight_smile:
Enjoy guys! [import]uid: 9033 topic_id: 2109 reply_id: 302109[/import]

Hi the download link is broken, do you still have this file or the code to edit? i’ve tried but i think i’m missing something.

EDIT: Dont worry link working now. [import]uid: 13522 topic_id: 2109 reply_id: 20772[/import]

Anyone using this? If so, any issues or perfectly safe to use? [import]uid: 7863 topic_id: 2109 reply_id: 25247[/import]

Thx @eMpire

I am using it … and no issues so far… [import]uid: 9592 topic_id: 2109 reply_id: 26571[/import]

@Alen - thanks I will give it a go [import]uid: 7863 topic_id: 2109 reply_id: 26575[/import]

I made the same modification to the movieclip library a few days ago and it works splendid. [import]uid: 36054 topic_id: 2109 reply_id: 26624[/import]

What is the best way to use this when the individual movie clip graphics are different dimensions whereas this only allows me to specify one width and height. [import]uid: 7863 topic_id: 2109 reply_id: 26872[/import]

You have a different problem than I or the above poster had. You should modify movieclip.lua so that it fits your needs rather than trying to force what you’re doing into someone else’s modification of it.

In your case, I would modify it to accept two arguments: an array of strings of image files (like it already does), and an array of image sizes (which shouldn’t be too difficult to pull off).

[import]uid: 36054 topic_id: 2109 reply_id: 26901[/import]

@blasterv - thanks, that sounds like an excellent plan. I had considered just adding a bit of extra empty space to my images to make them all the same size but your solution will help keep the file size down as much as possible.

Cheers! [import]uid: 7863 topic_id: 2109 reply_id: 26904[/import]

hi, this doesn’t seem to work with the director class. any help? [import]uid: 13043 topic_id: 2109 reply_id: 44845[/import]

This may be outdated now.

Go use this one:

https://developer.anscamobile.com/code/movie-clips-and-retina-display [import]uid: 22392 topic_id: 2109 reply_id: 44846[/import]

Ah, silly me. Actually I was using another version of movieclip.lua by M.Hartlef which can set the speed of the animation. So I had mapAnimation:setSpeed(0.7); inside my code, which obviously doesn’t work with this retina version of movieclip.lua.

Thanks [import]uid: 13043 topic_id: 2109 reply_id: 44862[/import]