Skip to content

Instantly share code, notes, and snippets.

@adachic
Created January 25, 2013 18:15
Show Gist options
  • Save adachic/4636609 to your computer and use it in GitHub Desktop.
Save adachic/4636609 to your computer and use it in GitHub Desktop.
cocos2dで解像度で注意したいこと。iPhone5レチナか、レチナ以外iPhoneで、画面に表示される領域が異なる。 レチナ:640x960、非レチナ:320x480 レチナ以外iPhoneに合わせるのであれば、以下のL3にNOを代入するコードをいれれば良い。
-(BOOL) enableRetinaDisplay:(BOOL)enabled
{
enabled = NO;
// Already enabled ?
if( enabled && __ccContentScaleFactor == 2 )
return YES;
// Already disabled
if( ! enabled && __ccContentScaleFactor == 1 )
return YES;
// setContentScaleFactor is not supported
if (! [view_ respondsToSelector:@selector(setContentScaleFactor:)])
return NO;
// SD device
if ([[UIScreen mainScreen] scale] == 1.0)
return NO;
float newScale = enabled ? 2 : 1;
[self setContentScaleFactor:newScale];
// Load Hi-Res FPS label
[self createStatsLabel];
return YES;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment