Cocos2dx 图片加载小于原有分辨率

问题: 在多台Windows电脑上都出现了添加的精灵或者地图小于原有分辨率, 精灵缩小还可以通过setScale 调整, 但是瓦片地图通过scale缩放后会坐标点转换会出现很大的问题

 

解决方案: 

注释掉这段代码

   // if the frame's height is larger than the height of medium size.
    //if (frameSize.height > mediumResolutionSize.height)
    //{        
    //    director->setContentScaleFactor(MIN(largeResolutionSize.height/designResolutionSize.height, largeResolutionSize.width/designResolutionSize.width));
    //}
    //// if the frame's height is larger than the height of small size.
    //else if (frameSize.height > smallResolutionSize.height)
    //{        
    //    director->setContentScaleFactor(MIN(mediumResolutionSize.height/designResolutionSize.height, mediumResolutionSize.width/designResolutionSize.width));
    //}
    //// if the frame's height is smaller than the height of medium size.
    //else
    //{        
    //    director->setContentScaleFactor(MIN(smallResolutionSize.height/designResolutionSize.height, smallResolutionSize.width/designResolutionSize.width));
    //}

原因是通过更改静态变量 designResolutionSize 改变游戏分辨率大小后

static cocos2d::Size designResolutionSize = cocos2d::Size(480, 320);
static cocos2d::Size smallResolutionSize = cocos2d::Size(480, 320);
static cocos2d::Size mediumResolutionSize = cocos2d::Size(1024, 768);
static cocos2d::Size largeResolutionSize = cocos2d::Size(2048, 1536);

frameSize.height > smallResolutionSize.height 引起了相关缩放

 

 

你可能感兴趣的:(Cocos2dx 图片加载小于原有分辨率)