From f9a30bb9d55fcce42988d768728e4b13a3b0060a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D0=B5=D1=81=D1=88=D0=B0=D0=BF=D0=BE=D1=88=D0=BD?= =?UTF-8?q?=D0=B8=D0=BA=D0=BE=D0=B2=20=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0?= Date: Tue, 7 Mar 2017 15:52:35 +0300 Subject: [PATCH 1/3] Enable support of retina displays --- cocos2d/core/platform/CCConfig.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos2d/core/platform/CCConfig.js b/cocos2d/core/platform/CCConfig.js index 027bede099..7344ff1bfc 100644 --- a/cocos2d/core/platform/CCConfig.js +++ b/cocos2d/core/platform/CCConfig.js @@ -267,7 +267,7 @@ cc.DRAWNODE_TOTAL_VERTICES = 20000; * @constant * @type {Number} */ -cc.IS_RETINA_DISPLAY_SUPPORTED = 0; +cc.IS_RETINA_DISPLAY_SUPPORTED = 1; /** * Default engine From 86d84741da31b9374032dca28e80a1676e18db36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D0=B5=D1=81=D1=88=D0=B0=D0=BF=D0=BE=D1=88=D0=BD?= =?UTF-8?q?=D0=B8=D0=BA=D0=BE=D0=B2=20=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0?= Date: Wed, 8 Mar 2017 10:28:35 +0300 Subject: [PATCH 2/3] =?UTF-8?q?Remove=20useless=20cc.IS=5FRETINA=5FDISPLAY?= =?UTF-8?q?=5FSUPPORTED=20macro=20and=20it=E2=80=99s=20usage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cocos2d/core/platform/CCConfig.js | 7 ------- cocos2d/core/platform/CCMacro.js | 12 +++--------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/cocos2d/core/platform/CCConfig.js b/cocos2d/core/platform/CCConfig.js index 7344ff1bfc..76730a0ac9 100644 --- a/cocos2d/core/platform/CCConfig.js +++ b/cocos2d/core/platform/CCConfig.js @@ -262,13 +262,6 @@ cc.LABELATLAS_DEBUG_DRAW = 0; cc.DRAWNODE_TOTAL_VERTICES = 20000; -/** - * Whether or not support retina display - * @constant - * @type {Number} - */ -cc.IS_RETINA_DISPLAY_SUPPORTED = 1; - /** * Default engine * @constant diff --git a/cocos2d/core/platform/CCMacro.js b/cocos2d/core/platform/CCMacro.js index 8ee902585b..a89331c9f1 100644 --- a/cocos2d/core/platform/CCMacro.js +++ b/cocos2d/core/platform/CCMacro.js @@ -244,10 +244,8 @@ cc.FLT_EPSILON = 0.0000001192092896; * @return {Number} * @function */ -cc.contentScaleFactor = cc.IS_RETINA_DISPLAY_SUPPORTED ? function () { +cc.contentScaleFactor = function () { return cc.director._contentScaleFactor; -} : function () { - return 1; }; /** @@ -312,12 +310,10 @@ cc._sizePixelsToPointsOut = function (sizeInPixels, outSize) { * @return {cc.Rect} * @function */ -cc.rectPixelsToPoints = cc.IS_RETINA_DISPLAY_SUPPORTED ? function (pixel) { +cc.rectPixelsToPoints = function (pixel) { var scale = cc.contentScaleFactor(); return cc.rect(pixel.x / scale, pixel.y / scale, pixel.width / scale, pixel.height / scale); -} : function (p) { - return p; }; /** @@ -326,12 +322,10 @@ cc.rectPixelsToPoints = cc.IS_RETINA_DISPLAY_SUPPORTED ? function (pixel) { * @return {cc.Rect} * @function */ -cc.rectPointsToPixels = cc.IS_RETINA_DISPLAY_SUPPORTED ? function (point) { +cc.rectPointsToPixels = function (point) { var scale = cc.contentScaleFactor(); return cc.rect(point.x * scale, point.y * scale, point.width * scale, point.height * scale); -} : function (p) { - return p; }; //some gl constant variable From 7d04cbc1bc18deb178b7db5a8b38879b76ab55bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D0=B5=D1=81=D1=88=D0=B0=D0=BF=D0=BE=D1=88=D0=BD?= =?UTF-8?q?=D0=B8=D0=BA=D0=BE=D0=B2=20=D0=9D=D0=B8=D0=BA=D0=B8=D1=82=D0=B0?= Date: Wed, 8 Mar 2017 10:31:26 +0300 Subject: [PATCH 3/3] Remove cc.RETINA_DISPLAY_SUPPORT deprecated macro. --- cocos2d/core/platform/CCConfig.js | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/cocos2d/core/platform/CCConfig.js b/cocos2d/core/platform/CCConfig.js index 76730a0ac9..920ef69528 100644 --- a/cocos2d/core/platform/CCConfig.js +++ b/cocos2d/core/platform/CCConfig.js @@ -165,23 +165,6 @@ cc.TEXTURE_ATLAS_USE_VAO = 0; */ cc.TEXTURE_NPOT_SUPPORT = 0; -/** - *

- * If enabled, cocos2d supports retina display.
- * For performance reasons, it's recommended disable it in games without retina display support, like iPad only games.
- *
- * To enable set it to 1. Use 0 to disable it. Enabled by default.
- *
- * This value governs only the PNG, GIF, BMP, images.
- * This value DOES NOT govern the PVR (PVR.GZ, PVR.CCZ) files. If NPOT PVR is loaded, then it will create an NPOT texture ignoring this value.
- * To modify it, in Web engine please refer to CCConfig.js, in JSB please refer to CCConfig.h - *

- * @constant - * @type {Number} - * @deprecated This value will be removed in 1.1 and NPOT textures will be loaded by default if the device supports it. - */ -cc.RETINA_DISPLAY_SUPPORT = 1; - /** *

* It's the suffix that will be appended to the files in order to load "retina display" images.