Commit b17cfbc7 authored by 范雪寒's avatar 范雪寒

feat:屏幕适配算法

parent 2d09c8e6
......@@ -36,7 +36,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
initBg() {
const canvas = cc.find('Canvas');
const bgImg = cc.find('Canvas/bgImg');
bgImg.scale = Math.max(canvas.width / bgImg.width, canvas.height / bgImg.height);
const bg = cc.find('Canvas/bg');
bg.scale = Math.min(canvas.width / bg.width, canvas.height / bg.height);
}
// update (dt) {},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment