Skip to content

Commit 66489de

Browse files
committed
Merge pull request #1511 from pandamicro/develop
Fixed #3824: EGLView now works well without initialization of director
2 parents b1c372b + 586fcdd commit 66489de

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

HelloHTML5World/main.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,13 @@ var cocos2dApp = cc.Application.extend({
4040
alert("Browser doesn't support WebGL");
4141
return false;
4242
}
43-
// initialize director
44-
var director = cc.Director.getInstance();
4543

4644
cc.EGLView.getInstance().resizeWithBrowserSize(true);
4745
cc.EGLView.getInstance().setDesignResolutionSize(800, 450, cc.RESOLUTION_POLICY.SHOW_ALL);
4846

47+
// initialize director
48+
var director = cc.Director.getInstance();
49+
4950
// turn on display FPS
5051
director.setDisplayStats(this.config['showFPS']);
5152

cocos2d/core/platform/CCEGLView.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,10 @@ cc.EGLView = cc.Class.extend(/** @lends cc.EGLView# */{
828828

829829
cc.EGLView.getInstance = function () {
830830
if (!this._instance) {
831-
this._instance = new cc.EGLView();
831+
// First init director
832+
cc.Director.getInstance();
833+
834+
this._instance = this._instance || new cc.EGLView();
832835
this._instance.initialize();
833836
}
834837
return this._instance;

0 commit comments

Comments
 (0)