|
@ -50,6 +50,24 @@ export default class Game { |
|
|
height: 0, |
|
|
height: 0, |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
private screenInfo() { |
|
|
|
|
|
const curDirection = detectOrient(); |
|
|
|
|
|
if (curDirection === EDirection.Portrait) { |
|
|
|
|
|
const width = document.documentElement.clientWidth * 1136 / 640 |
|
|
|
|
|
const height = document.documentElement.clientWidth |
|
|
|
|
|
return { |
|
|
|
|
|
widght: height, |
|
|
|
|
|
height: width, |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
const width = document.documentElement.clientHeight * 1136 / 640 |
|
|
|
|
|
const height = document.documentElement.clientHeight |
|
|
|
|
|
return { |
|
|
|
|
|
widght: width, |
|
|
|
|
|
height: height, |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
getInfo() { |
|
|
getInfo() { |
|
|
return this.info; |
|
|
return this.info; |
|
|
} |
|
|
} |
|
@ -60,8 +78,9 @@ export default class Game { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
updateView() { |
|
|
updateView() { |
|
|
let screenWidght = document.documentElement.clientWidth; |
|
|
const screenInfo = this.screenInfo() |
|
|
let screenHeight = document.documentElement.clientHeight; |
|
|
let screenWidght = screenInfo.widght; |
|
|
|
|
|
let screenHeight = screenInfo.height; |
|
|
this.renderer.resize(screenWidght, screenHeight); |
|
|
this.renderer.resize(screenWidght, screenHeight); |
|
|
let offsetWidth = 0; |
|
|
let offsetWidth = 0; |
|
|
let offsetHeight = 0; |
|
|
let offsetHeight = 0; |
|
@ -114,8 +133,9 @@ export default class Game { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
init() { |
|
|
init() { |
|
|
let screenWidght = document.documentElement.clientWidth; |
|
|
const screenInfo = this.screenInfo() |
|
|
let screenHeight = document.documentElement.clientHeight; |
|
|
let screenWidght = screenInfo.widght; |
|
|
|
|
|
let screenHeight = screenInfo.height; |
|
|
const stage = new Container(); |
|
|
const stage = new Container(); |
|
|
stage.name = "root"; |
|
|
stage.name = "root"; |
|
|
let renderer = autoDetectRenderer({ |
|
|
let renderer = autoDetectRenderer({ |
|
|