cocos creator模拟器自定义机型(如:自定义800*600大小分辨率的机型)

我们可以在CC的安装路径中找到这些机型的定义。

/Applications/CocosCreator⁩/⁨Contents/⁨Resources/⁨static/⁨preview-templates⁩/boot.js 文件预定义了各种机型的各种分辨率。

 // init device resolutions
    var devices = [
        { name: 'Apple iPad', width: 1024, height: 768, ratio: 2 },
        { name: 'Apple iPad Mini', width: 1024, height: 768, ratio: 1 },
        { name: 'Apple iPhone 4', width: 320, height: 480, ratio: 2 },
        { name: 'Apple iPhone 5', width: 320, height: 568, ratio: 2 },
        { name: 'Apple iPhone 6', width: 375, height: 667, ratio: 2 },
        { name: 'Apple iPhone 6 Plus', width: 414, height: 736, ratio: 3 },
        { name: 'Apple iPhoneX', width: 1792, height: 828, ratio: 1 },
        { name: 'Huawei P9', width: 540, height: 960, ratio: 2},
        { name: 'Huawei Mate9 Pro', width: 720, height: 1280, ratio: 2},
        { name: 'Goolge Nexus 4', width: 384, height: 640, ratio: 2 },
        { name: 'Goolge Nexus 5', width: 360, height: 640, ratio: 3 },
        { name: 'Goolge Nexus 6', width: 412, height: 732, ratio: 3.5 },
        { name: 'Goolge Nexus 7', width: 960, height: 600, ratio: 2 },

如设计一个800*600的,可以乘以一个比例系数

{ name: 'vipkid', width: 1067, height: 800, ratio: 1 },
发布了1620 篇原创文章 · 获赞 144 · 访问量 179万+

猜你喜欢

转载自blog.csdn.net/themagickeyjianan/article/details/89353925