Skip to content

Fixed #3824: EGLView now works well without initialization of director #1511

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 1 commit into from
Jan 23, 2014
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
5 changes: 3 additions & 2 deletions HelloHTML5World/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ var cocos2dApp = cc.Application.extend({
alert("Browser doesn't support WebGL");
return false;
}
// initialize director
var director = cc.Director.getInstance();

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

// initialize director
var director = cc.Director.getInstance();

// turn on display FPS
director.setDisplayStats(this.config['showFPS']);

Expand Down
5 changes: 4 additions & 1 deletion cocos2d/core/platform/CCEGLView.js
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,10 @@ cc.EGLView = cc.Class.extend(/** @lends cc.EGLView# */{

cc.EGLView.getInstance = function () {
if (!this._instance) {
this._instance = new cc.EGLView();
// First init director
cc.Director.getInstance();

this._instance = this._instance || new cc.EGLView();
this._instance.initialize();
}
return this._instance;
Expand Down