Director类与Caches

来源:互联网 发布:液压系统绘图软件 编辑:程序博客网 时间:2024/06/01 16:31

在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(动画缓存)。

待续...

原创粉丝点击