Created
January 25, 2013 18:15
-
-
Save adachic/4636609 to your computer and use it in GitHub Desktop.
cocos2dで解像度で注意したいこと。iPhone5レチナか、レチナ以外iPhoneで、画面に表示される領域が異なる。
レチナ:640x960、非レチナ:320x480
レチナ以外iPhoneに合わせるのであれば、以下のL3にNOを代入するコードをいれれば良い。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(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