28 lines
695 B
TypeScript
28 lines
695 B
TypeScript
|
|
import { config } from "./constants/config"
|
||
|
|
|
||
|
|
Laya.addBeforeInitCallback((stageConfig) => {
|
||
|
|
const { breakpoint } = config
|
||
|
|
if (window.innerWidth / window.innerHeight <= breakpoint) {
|
||
|
|
stageConfig.designWidth = 1080
|
||
|
|
stageConfig.designHeight = 1920
|
||
|
|
stageConfig.scaleMode = "fixedwidth"
|
||
|
|
}
|
||
|
|
else {
|
||
|
|
stageConfig.designWidth = 1920
|
||
|
|
stageConfig.designHeight = 1080
|
||
|
|
stageConfig.scaleMode = "fixedauto"
|
||
|
|
}
|
||
|
|
})
|
||
|
|
|
||
|
|
export async function main() {
|
||
|
|
console.log("entry")
|
||
|
|
const { breakpoint } = config
|
||
|
|
// 加载场景并打开场景
|
||
|
|
if (window.innerWidth / window.innerHeight <= breakpoint) {
|
||
|
|
Laya.Scene.open("Scene.ls")
|
||
|
|
}
|
||
|
|
else {
|
||
|
|
Laya.Scene.open("Scene.ls")
|
||
|
|
}
|
||
|
|
}
|