platformize-pixi
v6.2.4
Published
platformize pixjs to many platform wechat/taobao miniprogram/game
Downloads
4
Readme
platformize-pixi
[email protected]
专门适配
使用
pnpm i -S [email protected]
# 根据实际使用模块安装 https://pixijs.io/customize/
# 模块引入可参考 [tests-pixi/pixi.ts](../../examples/tests-pixi/pixi.ts)
pnpm i -S @pixi/[email protected] \
@pixi/[email protected] \
@pixi/[email protected] \
@pixi/[email protected] \
@pixi/[email protected] \
@pixi/[email protected] \
@pixi/[email protected] \
@pixi/[email protected] \
@pixi/[email protected] \
@pixi/[email protected] \
@pixi/[email protected]
rollup.config.js
注入特定配置
import { mergeRollupOptions } from 'platformize-pixi/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-pixi';
const width = canvasClientWidth;
const height = canvasClientHeight;
const wechatPlatform = new WechatPlatform(canvas, width, height);
PlatformManager.set(wechatPlatform);
wechatPlatform.init(PIXI, canvas2D); // 需要额外的注入canvas2d的引用来支持text-bitmap
window.innerWidth
window.innerHeight
window.devicePixelRatio
requestAnimationFrame();
cancelAnimationFrame();
const xhr = new XMLHttpRequest();
...等等
// 使用完毕后销毁资源
wechatPlatform.dispose();
详细例子
已知问题
讨论
可通过群里 DeepKolos 联系我
赞助
如果项目对您有帮助或者有适配需求,欢迎打赏
感谢各位支持~~