pixijs / particle-emitter

A particle system for PixiJS
http://pixijs.io/particle-emitter/docs
MIT License
793 stars 125 forks source link

Using pixi-particles with Pixi5-Legacy #113

Closed jsysnowy closed 4 years ago

jsysnowy commented 4 years ago

Hey sorry if I'm being dumb but do i need to edit the files whenever i pull this down to import from pixi.js-legacy instead of pixi.js if i am using the legacy build of Pixi5, or is there an easier solution to get this working properly?

Also; it seems that the lib files are still using PIXI.Texture.fromImage() instead of PIXI.Texture.from() which i also need to edit manually to get this working. I looked around a bit and haven't seen anyone else with this issue, so it makes me think i'm doing something wrong; but i can't quite see what.

Thanks for any help on this :)

andrewstart commented 4 years ago

You aren't doing anything wrong, I forgot to handle the texture string case when I added support for Pixi 5. In the meantime, when supplying an Emitter with textures, you can give it Texture objects instead of strings and that will always work.

andrewstart commented 4 years ago

The fromImage() issue is now fixed in v4.1.3

jsysnowy commented 4 years ago

Awesome that's good to know, thank you for fixing that :)

I guess using pixi.js-legacy is just something we're going to have to deal with for now unless you have any ideas on that one too..? I can't really see a way around it, i thought it was the fact that it's referencing files in lib/ which uses import * as pixi from "pixi,js", opposed to in dist/ which uses this.PIXI = this.PIXI || {}; .. so we can't use webpack config to get around this by using plugins to resolve this properly with:

new webpack.ProvidePlugin({
    PIXI: 'pixi.js-legacy'
})

I tried to play with it a bit but i couldn't get anywhere with it, i have to admit this kind of thing isn't my strongest area by far so i could be missing something, so i might be going down the completely wrong track .. if it is just a limitation then it's fine and I can live with it; it's just going to be a little more work to get it working :)

leomeloxp commented 4 years ago

It seems that adding the following to the provide plugin works...

new webpack.ProvidePlugin({
    'pixi.js': 'pixi.js-legacy'
})

Just make sure to clear any possible caches, re npm i and then start your webpack tasks.

jsysnowy commented 4 years ago

Aah thank you yes that has resolved it! Guess it was just a user error then.. 😛 I didn't realize it worked like that hehe