From e467bf1f58f1d11cd3405d91651f97332a4ca068 Mon Sep 17 00:00:00 2001 From: knoxHuang <821686174@qq.com> Date: Wed, 31 Aug 2016 09:29:46 +0800 Subject: [PATCH] add getAllTextures for CCTextureCache for fireball/issues/2836 --- cocos2d/core/platform/CCView.js | 5 ++--- cocos2d/core/textures/CCTextureCache.js | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/cocos2d/core/platform/CCView.js b/cocos2d/core/platform/CCView.js index 86df5e28b0..646b8a3d49 100644 --- a/cocos2d/core/platform/CCView.js +++ b/cocos2d/core/platform/CCView.js @@ -151,7 +151,7 @@ var View = cc._Class.extend({ __resizeWithBrowserSize: false, _isAdjustViewPort: true, _targetDensityDPI: null, - _antiAliasEnabled: false, + _antiAliasEnabled: true, /** * Constructor of View @@ -184,7 +184,6 @@ var View = cc._Class.extend({ _t._rpFixedWidth = new cc.ResolutionPolicy(_strategyer.EQUAL_TO_FRAME, _strategy.FIXED_WIDTH); _t._targetDensityDPI = cc.macro.DENSITYDPI_HIGH; - _t.enableAntiAlias(true); }, // Resize helper functions @@ -469,7 +468,7 @@ var View = cc._Class.extend({ * !#en Returns whether the current enable on anti-alias * !#zh 返回当前是否抗锯齿 * @method isAntiAliasEnabled - * @param {Boolean} enabled - Pass false to make pixel art sharp. + * @return {Boolean} */ isAntiAliasEnabled: function () { return this._antiAliasEnabled; diff --git a/cocos2d/core/textures/CCTextureCache.js b/cocos2d/core/textures/CCTextureCache.js index 54bd675522..ac6650163b 100644 --- a/cocos2d/core/textures/CCTextureCache.js +++ b/cocos2d/core/textures/CCTextureCache.js @@ -125,6 +125,21 @@ var textureCache = /** @lends cc.textureCache# */{ return this._textureColorsCache[key]; }, + /** + * #en get all textures + * #zh 获取所有贴图 + * @method getAllTextures + * @return {Texture2D[]} + */ + getAllTextures: function () { + var texs = []; + for (var key in this._textures) { + var item = this._textures[key]; + texs.push(item); + } + return texs; + }, + /** *
Purges the dictionary of loaded textures.
* Call this method if you receive the "Memory Warning"