Skip to content

Commit 2a30494

Browse files
committed
Fix cc.view.setRealPixelResolution with all policies
1 parent c0242a9 commit 2a30494

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

CCBoot.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1962,7 +1962,7 @@ function _load(config) {
19621962
var modules = config["modules"] || [];
19631963
var moduleMap = modulesJson["module"];
19641964
var jsList = [];
1965-
if (cc.sys.supportWebGL && modules.indexOf("base4webgl") < 0) modules.splice(0, 0, "base4webgl");
1965+
if (cc.sys.capabilities["opengl"] && modules.indexOf("base4webgl") < 0) modules.splice(0, 0, "base4webgl");
19661966
else if (modules.indexOf("core") < 0) modules.splice(0, 0, "core");
19671967
for (var i = 0, li = modules.length; i < li; i++) {
19681968
var arr = _getJsListOfModule(moduleMap, modules[i], engineDir);
@@ -2135,7 +2135,7 @@ cc.game = /** @lends cc.game# */{
21352135
if (this._paused) return;
21362136
this._paused = true;
21372137
// Pause audio engine
2138-
cc.audioEngine._pausePlaying();
2138+
cc.audioEngine && cc.audioEngine._pausePlaying();
21392139
// Pause main loop
21402140
if (this._intervalId)
21412141
window.cancelAnimationFrame(this._intervalId);
@@ -2149,7 +2149,7 @@ cc.game = /** @lends cc.game# */{
21492149
if (!this._paused) return;
21502150
this._paused = false;
21512151
// Resume audio engine
2152-
cc.audioEngine._resumePlaying();
2152+
cc.audioEngine && cc.audioEngine._resumePlaying();
21532153
// Resume main loop
21542154
this._runMainLoop();
21552155
},

cocos2d/core/platform/CCEGLView.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -302,20 +302,20 @@ cc.EGLView = cc.Class.extend(/** @lends cc.view# */{
302302

303303
_setViewportMeta: function (metas, overwrite) {
304304
var vp = document.getElementById("cocosMetaElement");
305-
if(vp){
305+
if(vp && overwrite){
306306
document.head.removeChild(vp);
307307
}
308308

309309
var elems = document.getElementsByName("viewport"),
310310
currentVP = elems ? elems[0] : null,
311311
content, key, pattern;
312312

313-
vp = document.createElement("meta");
313+
content = currentVP ? currentVP.content : "";
314+
vp = vp || document.createElement("meta");
314315
vp.id = "cocosMetaElement";
315316
vp.name = "viewport";
316317
vp.content = "";
317318

318-
content = currentVP ? currentVP.content : "";
319319
for (key in metas) {
320320
if (content.indexOf(key) == -1) {
321321
content += "," + key + "=" + metas[key];
@@ -698,7 +698,6 @@ cc.EGLView = cc.Class.extend(/** @lends cc.view# */{
698698

699699
// Set body width to the exact pixel resolution
700700
document.body.style.width = width + "px";
701-
document.body.style.height = "100%";
702701
document.body.style.left = "0px";
703702
document.body.style.top = "0px";
704703

@@ -1309,4 +1308,4 @@ cc.ResolutionPolicy.FIXED_WIDTH = 4;
13091308
* @static
13101309
* Unknow policy
13111310
*/
1312-
cc.ResolutionPolicy.UNKNOWN = 5;
1311+
cc.ResolutionPolicy.UNKNOWN = 5;

0 commit comments

Comments
 (0)