博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
怎么提升游戏加载速度?
阅读量:6895 次
发布时间:2019-06-27

本文共 755 字,大约阅读时间需要 2 分钟。

解决办法:

在空闲时候异步预加载,后面切换场景就会快很多,前提是内存充足的情况下。

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 end12 13 for i = 1, #jhmjResList do14     if #(jhmjResList[i]) > 0 then15         display.loadImage(jhmjResList[i], callBack)16     end17 end

 

转载于:https://www.cnblogs.com/xiaoxiangmomo/p/10570955.html

你可能感兴趣的文章
谷歌“信息安全公主”:我是一名好黑客
查看>>
Web Service学习笔记
查看>>
windows无法搜索新更新 80072ee2
查看>>
win7 32/64bit VS2010 OpenCV 2.4.9 环境配置
查看>>
tomcat配置虚拟主机
查看>>
【百度地图API】百度API卫星图使用方法和卫星图对比工具
查看>>
XCode中使用SVN 教程
查看>>
Guice--Java依赖注入框架
查看>>
第二、UIScrollView的使用大全
查看>>
Ehcache(03)——Ehcache中储存缓存的方式
查看>>
基于海康监控的图像识别设计
查看>>
Senparc.Weixin.MP SDK 微信公众平台开发教程(十五):消息加密
查看>>
CCNA2.0笔记_HSRP
查看>>
wamp You don't have permission to access / on this server等问题的解决.
查看>>
【POJ】3071 Football
查看>>
ArcGis 统计方法
查看>>
Resource interpreted as Script but transferred with MIME type text/plain
查看>>
VirtualBox安装及使用说明和虚拟机安装XP系统图文教程
查看>>
【android】优秀的UI资源站点集合
查看>>
iOS 容易引“起循环引用”的三种场景
查看>>