[adapters] 增加小游戏适配部分源码

This commit is contained in:
SmallMain
2024-10-16 17:12:08 +08:00
parent 887d4a96c9
commit 07bf3b7a96
345 changed files with 38447 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
const { pixelRatio, windowWidth, windowHeight } = my.getSystemInfoSync()
const devicePixelRatio = pixelRatio;
let width, height;
if ($global.screencanvas.getBoundingClientRect) {
let rect = $global.screencanvas.getBoundingClientRect();
width = rect.width;
height = rect.height;
} else {
width = windowWidth;
height = windowHeight;
}
export const innerWidth = width;
export const innerHeight = height;
export { devicePixelRatio }
export const screen = {
width,
height,
availWidth: innerWidth,
availHeight: innerHeight,
availLeft: 0,
availTop: 0,
}
export const performance = {
now: Date.now
};
export const ontouchstart = null;
export const ontouchmove = null;
export const ontouchend = null;