import { config } from "./constants/config"

Laya.addBeforeInitCallback((stageConfig) => {
  console.log(`window  innerWidth=${window.innerWidth} innerHeight=${window.innerHeight}`)
  console.log(`stageConfig  designWidth=${stageConfig.designWidth} designWidth=${stageConfig.designHeight}`)
  if (window.innerWidth > window.innerHeight) {
    stageConfig.designWidth = config.DESIGN_HEIGHT
    stageConfig.designHeight = config.DESIGN_WIDTH
    stageConfig.scaleMode = "fixedauto"
    config.H_SCREEN = true
  } else {
    stageConfig.designWidth = config.DESIGN_WIDTH
    stageConfig.designHeight = config.DESIGN_HEIGHT
    stageConfig.scaleMode = "fixedauto"
    config.H_SCREEN = false
  }
  console.log(`横屏=${config.H_SCREEN}`)
})

export async function main() {
  console.log("entry")
  // 加载场景并打开场景
  Laya.Scene.open("Scene.ls")
}
