Director类与Caches

深入解析Cocos2d-x中的CCDirector类及其作用,了解如何管理场景并获取应用信息。同时,介绍Cocos2d-x中重要的缓存对象,包括纹理缓存、精灵帧缓存和动画缓存,探讨它们在游戏开发中的应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在cocos2d-x example beginner's guide Ch2,P19中(翻译凑合看)


The director and caches
Then comes the all-knowing CCDirector and all-encompassing cache objects. CCDirector
manages scenes and knows all about your application. You will make calls to it to get to that
information, and to change some of it: things such as screen size, frame rate, scale factor,

and so on.

Director 和 Caches

接下来,是大名鼎鼎的 CCDirector 和包罗万象的 cache objects。CCDirector类调度场景,并知晓游戏的一草一木。

调用CCDirector中的方法,可以获得和改变许多属性,比如:屏幕尺寸,帧率,比例因子,等等。

The caches are collector objects. The most important ones are CCTextureCache,
CCSpriteFrameCache, and CCAnimationCache. These are responsible for storing key
information regarding those two important rectangles I talked about. In fact, every sort of
data that is used repeatedly in Cocos2d-x will be kept in some sort of cache list.
Both CCDirector and all cache objects are singletons: a special sort of class that is

instantiated only once and this one instance can usually be accessed by any other object.

缓存是一个对象集合,最主要 的有:CCTextureCache(纹理缓存),CCSpriteFrameCache(精灵帧缓存)和CCAnimationCache(动画缓存)。

待续...

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值