Cocos2D + Disabling only Retina iPad Graphics

一世执手 提交于 2019-12-06 16:01:42

问题


I'm running into an issue now when exporting my cocos2d based games out of Xcode 4.3+.

While I'm not intending on including iPad Retina graphics with my game, it seems the game wants Retina iPad graphics and is now loading everything incorrectly on iPad Retina Only.

Is there a quick and simple way to disable iPad Retina images only when loading assets from a scale based UI?

Thanks!


回答1:


So it was quite simple. Added this code to the AppDelegate.m File

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
    [director enableRetinaDisplay:NO];


} else {

    [director enableRetinaDisplay:YES];

}

Boom. Hope this can help someone else as I didn't see any readily available solutions.




回答2:


as of july 2015 this still works great. you just have to change it like this:

if ( [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad )
    {
        [director_ enableRetinaDisplay:NO];
    } else {
        if( ! [director_ enableRetinaDisplay:YES] )
    }


来源:https://stackoverflow.com/questions/14422637/cocos2d-disabling-only-retina-ipad-graphics

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!