Skip to content

Latest commit

 

History

History
83 lines (59 loc) · 2.49 KB

File metadata and controls

83 lines (59 loc) · 2.49 KB

platformize-playcanvas

使用

rollup.config.js注入特定配置

import { mergeRollupOptions } from 'platformize-playcanvas/dist-plugin';

export default mergeRollupOptions(
  {
    input: ['./miniprogram/pages/index/index.ts'],
    output: {
      format: 'cjs',
      dir: 'miniprogram/',
      entryFileNames: 'pages/[name]/[name].js',
    },
  },
  { minify: process.env.BUILD === 'production' },
);

自行组装版本见这里

import { PlatformManager, WechatPlatform } from 'platformize-playcanvas';

const width = canvasClientWidth;
const height = canvasClientHeight;
const wechatPlatform = new WechatPlatform(canvas, width, height);
PlatformManager.set(wechatPlatform);

window.innerWidth
window.innerHeight
window.devicePixelRatio
requestAnimationFrame();
cancelAnimationFrame();
const xhr = new XMLHttpRequest();
...等等
// 使用完毕后销毁资源
wechatPlatform.dispose();

详细例子

注意事项

转换 playcanvas 编辑器导出项目到小程序

工作目录为仓库根目录

node ./packages/platformize-playcanvas/cli.js -src=./resources/playcanvas-editor-exported/ -dst=./examples/tests-playcanvas/saved-project-auto/ -url=http://127.0.0.1:8080/

讨论

可通过群里 DeepKolos 联系我

赞助

如果项目对您有帮助或者有适配需求,欢迎打赏

赞赏码

感谢各位支持~~

时间 大佬
2021/12/20 神神