大佬你好,我现在是用creator 3.4.1版本,使用setDesignResolutionSize也没有效果,大佬方便贴一下代码嘛?
我的代码如下:
start() {
const SCREEN_RATIO = 750 / 1330;
// 动态自适应宽高
const { width, height } = screen;
if (width / height <= SCREEN_RATIO) {
// 高度溢出
console.log("高度溢出", width, height);
} else {
// 宽度溢出
const _width = SCREEN_RATIO * height;
// view.setDesignResolutionSize(_width, height, ResolutionPolicy.FIXED_HEIGHT);
(screen as any).windowSize = new Size(_width, height);
console.log("宽度溢出", width, height);
console.log(_width, height);
}
}

