mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 07:42:38 +08:00
Merge branch '3d' of https://github.com/cocos-creator/engine into 3d
This commit is contained in:
@@ -160,12 +160,6 @@ class Director extends EventTarget {
|
||||
|
||||
init () {
|
||||
|
||||
this._root = new Root(cc.game._gfxDevice);
|
||||
let rootInfo = {};
|
||||
if(!this._root.initialize(rootInfo)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this._totalFrames = 0;
|
||||
this._lastUpdate = performance.now();
|
||||
this._paused = false;
|
||||
@@ -180,6 +174,13 @@ class Director extends EventTarget {
|
||||
}
|
||||
|
||||
this.sharedInit();
|
||||
|
||||
this._root = new Root(cc.game._gfxDevice);
|
||||
let rootInfo = {};
|
||||
if(!this._root.initialize(rootInfo)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+9
-6
@@ -699,15 +699,18 @@ class Game extends EventTarget {
|
||||
this._gfxDevice = new cc.WebGLGFXDevice();
|
||||
}
|
||||
|
||||
let nativeWidth = Math.floor(screen.width * cc.view._devicePixelRatio);
|
||||
let nativeHeight = Math.floor(screen.height * cc.view._devicePixelRatio);
|
||||
this._gfxDevice.initialize({
|
||||
const opts = {
|
||||
canvasElm: localCanvas,
|
||||
debug: true,
|
||||
devicePixelRatio: window.devicePixelRatio,
|
||||
nativeWidth,
|
||||
nativeHeight,
|
||||
});
|
||||
nativeWidth: Math.floor(screen.width * cc.view._devicePixelRatio),
|
||||
nativeHeight: Math.floor(screen.height * cc.view._devicePixelRatio),
|
||||
};
|
||||
// fallback if WebGL2 is actually unavailable
|
||||
if (!this._gfxDevice.initialize(opts) && useWebGL2) {
|
||||
this._gfxDevice = new cc.WebGLGFXDevice();
|
||||
this._gfxDevice.initialize(opts);
|
||||
}
|
||||
}
|
||||
|
||||
if (!this._gfxDevice) {
|
||||
|
||||
Reference in New Issue
Block a user