platformize-playcanvas
v1.50.2
Published
platformize playcanvas to many platform wechat/taobao miniprogram/game
Downloads
6
Readme
platformize-playcanvas
使用
pnpm i -S [email protected] [email protected]
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();
详细例子
注意事项
- 小程序不支持网络动态加载
Script
, 需构建时引入, 例子可见tests-playcanvas/tween
转换 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/
需在resources/playcanvas-editor-exported
启动http服务
并修改文件内ip地址为自己ip的settings.js
讨论
可通过群里 DeepKolos 联系我
赞助
如果项目对您有帮助或者有适配需求,欢迎打赏
感谢各位支持~~
| 时间 | 大佬 | | ---------- | ---- | | 2021/12/20 | 神神 |