Fixed issues with pixi.js

This commit is contained in:
thepaperpilot 2022-08-22 00:16:00 -05:00
parent e8ba3f1f88
commit 61859049b9
6 changed files with 2265 additions and 2369 deletions

4613
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -12,9 +12,10 @@
"serve": "vite preview --host" "serve": "vite preview --host"
}, },
"dependencies": { "dependencies": {
"@pixi/app": "^6.4.2", "@pixi/app": "~6.3.2",
"@pixi/core": "^6.4.2", "@pixi/core": "~6.3.2",
"@pixi/particle-emitter": "^5.0.4", "@pixi/particle-emitter": "^5.0.4",
"@pixi/ticker": "~6.3.2",
"@vitejs/plugin-vue": "^2.3.3", "@vitejs/plugin-vue": "^2.3.3",
"@vitejs/plugin-vue-jsx": "^1.3.10", "@vitejs/plugin-vue-jsx": "^1.3.10",
"is-plain-object": "^5.0.0", "is-plain-object": "^5.0.0",

View file

@ -8,8 +8,9 @@
</template> </template>
<script lang="tsx"> <script lang="tsx">
import type { StyleValue } from "features/feature";
import { Application } from "@pixi/app"; import { Application } from "@pixi/app";
import type { StyleValue } from "features/feature";
import "lib/pixi";
import { processedPropType } from "util/vue"; import { processedPropType } from "util/vue";
import type { PropType } from "vue"; import type { PropType } from "vue";
import { defineComponent, nextTick, onBeforeUnmount, onMounted, ref, unref } from "vue"; import { defineComponent, nextTick, onBeforeUnmount, onMounted, ref, unref } from "vue";

View file

@ -1,9 +1,9 @@
import { Application } from "@pixi/app";
import type { EmitterConfigV3 } from "@pixi/particle-emitter"; import type { EmitterConfigV3 } from "@pixi/particle-emitter";
import { Emitter, upgradeConfig } from "@pixi/particle-emitter"; import { Emitter, upgradeConfig } from "@pixi/particle-emitter";
import type { GenericComponent, OptionsFunc, Replace, StyleValue } from "features/feature"; import type { GenericComponent, OptionsFunc, Replace, StyleValue } from "features/feature";
import { Component, GatherProps, getUniqueID } from "features/feature"; import { Component, GatherProps, getUniqueID } from "features/feature";
import ParticlesComponent from "features/particles/Particles.vue"; import ParticlesComponent from "features/particles/Particles.vue";
import { Application } from "@pixi/app";
import type { Computable, GetComputableType } from "util/computed"; import type { Computable, GetComputableType } from "util/computed";
import { createLazyProxy } from "util/proxies"; import { createLazyProxy } from "util/proxies";
import { Ref, shallowRef, unref } from "vue"; import { Ref, shallowRef, unref } from "vue";
@ -62,7 +62,8 @@ export function createParticles<T extends ParticlesOptions>(
}[] = []; }[] = [];
function onInit(app: Application) { function onInit(app: Application) {
(particles as GenericParticles).app.value = app; const genericParticles = particles as GenericParticles;
genericParticles.app.value = app;
emittersToAdd.forEach(({ resolve, config }) => resolve(new Emitter(app.stage, config))); emittersToAdd.forEach(({ resolve, config }) => resolve(new Emitter(app.stage, config)));
emittersToAdd = []; emittersToAdd = [];
} }

View file

@ -52,5 +52,6 @@ const showPrefix = computed(() => {
vertical-align: middle; vertical-align: middle;
margin-bottom: 20px; margin-bottom: 20px;
display: flex; display: flex;
transition-duration: 0s;
} }
</style> </style>

7
src/lib/pixi.ts Normal file
View file

@ -0,0 +1,7 @@
import { Application } from "@pixi/app";
import { BatchRenderer, Renderer } from "@pixi/core";
import { TickerPlugin } from "@pixi/ticker";
Application.registerPlugin(TickerPlugin);
Renderer.registerPlugin("batch", BatchRenderer);