platformize-pixi
TypeScript icon, indicating that this package has built-in type declarations

6.2.4 • Public • Published

platformize-pixi

pixijs@6.2.1 专门适配

使用

pnpm i -S platformize-pixi@6.2.1

# 根据实际使用模块安装 https://pixijs.io/customize/
# 模块引入可参考 [tests-pixi/pixi.ts](../../examples/tests-pixi/pixi.ts)
pnpm i -S @pixi/constants@6.2.1 \
          @pixi/core@6.2.1 \
          @pixi/math@6.2.1 \
          @pixi/runner@6.2.1 \
          @pixi/settings@6.2.1 \
          @pixi/ticker@6.2.1 \
          @pixi/utils@6.2.1 \
          @pixi/app@6.2.1 \
          @pixi/display@6.2.1 \
          @pixi/sprite@6.2.1 \
          @pixi/unsafe-eval@6.2.1

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 联系我

赞助

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

赞赏码

感谢各位支持~~

Readme

Keywords

none

Package Sidebar

Install

npm i platformize-pixi

Weekly Downloads

0

Version

6.2.4

License

MIT

Unpacked Size

34 kB

Total Files

19

Last publish

Collaborators

  • deepkolos