Commit fca8e3db authored by rockyl's avatar rockyl

修复

parent a5caae85
...@@ -349,6 +349,7 @@ export class Stage extends Container { ...@@ -349,6 +349,7 @@ export class Stage extends Container {
* @param {number} renderType 渲染类型2canvas * @param {number} renderType 渲染类型2canvas
* @param {boolean} transparent 透明否,默认透明true,此时bgColor无效 * @param {boolean} transparent 透明否,默认透明true,此时bgColor无效
* @param {number} bgColor 背景颜色十六进制 * @param {number} bgColor 背景颜色十六进制
* @param autoResize 是否自动重置尺寸
* @public * @public
* @since 1.0.0 * @since 1.0.0
*/ */
...@@ -360,7 +361,8 @@ export class Stage extends Container { ...@@ -360,7 +361,8 @@ export class Stage extends Container {
scaleMode: string = StageScaleMode.FIXED_WIDTH, scaleMode: string = StageScaleMode.FIXED_WIDTH,
renderType: RENDERER_TYPE = RENDERER_TYPE.WEBGL, renderType: RENDERER_TYPE = RENDERER_TYPE.WEBGL,
transparent: boolean = true, transparent: boolean = true,
bgColor: number = 0x000000 bgColor: number = 0x000000,
autoResize: boolean = false,
) { ) {
super(); super();
let s: Stage = this; let s: Stage = this;
...@@ -376,6 +378,7 @@ export class Stage extends Container { ...@@ -376,6 +378,7 @@ export class Stage extends Container {
s.rootDiv = div; s.rootDiv = div;
s.setFrameRate(frameRate); s.setFrameRate(frameRate);
s._scaleMode = scaleMode; s._scaleMode = scaleMode;
s.autoResize = autoResize;
//s.anchorX = desW >> 1; //s.anchorX = desW >> 1;
//s.anchorY = desH >> 1; //s.anchorY = desH >> 1;
......
...@@ -52,7 +52,7 @@ export async function launchWithConfig(config, loadingDelegate?, onStart?) { ...@@ -52,7 +52,7 @@ export async function launchWithConfig(config, loadingDelegate?, onStart?) {
setTimeout(resolve, 300); setTimeout(resolve, 300);
}); });
return await new Promise(resolve => { return await new Promise(resolve => {
const {containerId, designWidth, designHeight, frameRate, scaleMode, rendererType,} = config.options; const {containerId, designWidth, designHeight, frameRate, scaleMode, rendererType, bgColor, autoResize,} = config.options;
let stage = window['stage'] = new Stage( let stage = window['stage'] = new Stage(
containerId || "game-container", containerId || "game-container",
designWidth || 750, designWidth || 750,
...@@ -60,6 +60,9 @@ export async function launchWithConfig(config, loadingDelegate?, onStart?) { ...@@ -60,6 +60,9 @@ export async function launchWithConfig(config, loadingDelegate?, onStart?) {
frameRate || 60, frameRate || 60,
scaleMode || StageScaleMode.FIXED_WIDTH, scaleMode || StageScaleMode.FIXED_WIDTH,
rendererType || RENDERER_TYPE.WEBGL, rendererType || RENDERER_TYPE.WEBGL,
true,
bgColor,
autoResize,
); );
initAutoLayout(stage); initAutoLayout(stage);
Stage.flushAll(); Stage.flushAll();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment