Skip to content

Enable support of retina displays #3464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions cocos2d/core/platform/CCConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,23 +165,6 @@ cc.TEXTURE_ATLAS_USE_VAO = 0;
*/
cc.TEXTURE_NPOT_SUPPORT = 0;

/**
* <p>
* If enabled, cocos2d supports retina display.<br/>
* For performance reasons, it's recommended disable it in games without retina display support, like iPad only games.<br/>
* <br/>
* To enable set it to 1. Use 0 to disable it. Enabled by default.<br/>
* <br/>
* This value governs only the PNG, GIF, BMP, images.<br/>
* 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.<br/>
* To modify it, in Web engine please refer to CCConfig.js, in JSB please refer to CCConfig.h
* </p>
* @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;

/**
* <p>
* It's the suffix that will be appended to the files in order to load "retina display" images.<br/>
Expand Down Expand Up @@ -262,13 +245,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 = 0;

/**
* Default engine
* @constant
Expand Down
12 changes: 3 additions & 9 deletions cocos2d/core/platform/CCMacro.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

/**
Expand Down Expand Up @@ -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;
};

/**
Expand All @@ -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
Expand Down