Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Game Development

Reply
 
LinkBack Thread Tools Display Modes
Old 06-25-2010, 06:26 PM   #1 (permalink)
Registered Member
 
ama269's Avatar
 
Join Date: Jul 2009
Location: Austin, TX
Posts: 482
ama269 is on a distinguished road
Default High Res images in cocos2d

Anyone know if there is a solution in cocos2d to support high resolution imagery with iOS 4.0?

My code:
****
UIImage *Menu = [UIImage imageNamed:@"MenuBG"];

CCMenuItem *ppMenuItem = [CCMenuItemImage
itemFromNormalImage:@"Menu.png" selectedImage:@"Menu.png"
target:self selector:@selector(nilButtonTapped];

****

What I think may work is to pass the UIImage "Menu" to "itemFromNormalImage", however I get an uncaught exception when I attempt this.

Any ideas?

In the Programming guide it states:
"The UIImage class handles all of the work needed to load high-resolution images into your application. When creating new image objects, you use the same name to request both the standard and the high-resolution versions of your image. For example, if you have two image files, named Button.png and Button@2x.png, you would use the following code to request your button image:

UIImage* anImage = [UIImage imageNamed:@"Button"];

On devices with high-resolution screens, the imageNamed:, imageWithContentsOfFile:, and initWithContentsOfFile: methods automatically looks for a version of the requested image with the @2x modifier in its name. It if finds one, it loads that image instead. If you do not provide a high-resolution version of a given image, the image object still loads a standard-resolution image (if one exists) and scales it during drawing."
__________________
Check out our app review & recommendation site: http://www.mobileappbreakfast.com

Site: http://www.mobilebuffaloapps.com

Twitter: http://twitter.com/#!/mobilebuffalo

Facebook: http://tinyurl.com/47ljsf2

Mobile Buffalo's Apps: http://tinyurl.com/2br3ul5
ama269 is offline   Reply With Quote
Old 09-12-2011, 04:37 PM   #2 (permalink)
Digitally FlyŽ Software
 
JoeApps's Avatar
 
Join Date: Aug 2011
Location: www.joeapps.com
Age: 24
Posts: 10
JoeApps is on a distinguished road
Default Cocos2d

From what I understand from Cocos2d all you have to do is append "-hd" to the filename for Retina display images. And uncomment these lines in the AppDelegate (Or add them if you are not using the templates)

Code:
	// Enables High Res mode (Retina Display) on iPhone 4 and maintains low res on all other devices
	if( ! [director enableRetinaDisplay:YES] )
		CCLOG(@"Retina Display Not supported");
So in code all you would have to do is specify the non-retina image and it will look for the -hd versions of them, e.g. Menu.png and Menu-hd.png
JoeApps is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 401
11 members and 390 guests
7twenty7, ChrisYates, djohnson, Duncan C, gmarro, hussain1982, Kirkout, Retouchable, SLIC, walex, xzoonxoom
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,679
Threads: 94,128
Posts: 402,921
Top Poster: BrianSlick (7,990)
Welcome to our newest member, xzoonxoom
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 08:06 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0