标签:示例 layer tca back game end fun 就会 color
解决办法:
在空闲时候异步预加载,后面切换场景就会快很多,前提是内存充足的情况下。
cocos2d-x lua图片资源异步预加载示例:
1 local jhmjResList = {} 2 jhmjResList[#jhmjResList + 1] = "animate/jhmj_cpgh.png" 3 jhmjResList[#jhmjResList + 1] = "animate/game_flash_outcard_tips.png" 4 jhmjResList[#jhmjResList + 1] = "game/yule/jhmj/res/game/sp_trusteeCover.png" 5 jhmjResList[#jhmjResList + 1] = "game/yule/jhmj/res/game/sp_trusteeMan.png" 6 jhmjResList[#jhmjResList + 1] = "gameScene.png" 7 8 local function callBack(img) 9 local temp1 = cc.Sprite:createWithTexture(img) 10 yl.cacheLayer:addChild(temp1) 11 end 12 13 for i = 1, #jhmjResList do 14 if #(jhmjResList[i]) > 0 then 15 display.loadImage(jhmjResList[i], callBack) 16 end 17 end
标签:示例 layer tca back game end fun 就会 color
原文地址:https://www.cnblogs.com/xiaoxiangmomo/p/10570955.html