fish icon indicating copy to clipboard operation
fish copied to clipboard

Building the demo with no changes to src files causes it to stop working on a mobile device

Open bamsarker opened this issue 5 years ago • 4 comments

I've cloned the repo and the demo works in the dev tools (Wechat and QQ) and on my mobile device in the app (again, Wechat and QQ).

After running npm install and npm run build the demo continues to with in the dev tools but does not load on my mobile device, with no errors in the console or any feedback.

Perhaps you could remove package-lock.json from .gitignore so I can figure out the exact module versions you used.

Thanks!

bamsarker avatar Jul 29 '20 15:07 bamsarker

@bamsarker Fixed. You can try again.

After running npm install and npm run build the demo continues to with in the dev tools but does not load on my mobile device, with no errors in the console or any feedback.

This is because pixi.js v5.3.0 has added BitmapFonts and used the XMLDocument, but the wechat environment does not support them, so I have updated @iro/wechat-adapter.

JetLua avatar Jul 30 '20 02:07 JetLua

Thanks @JetLua this was very helpful.

Now I've got an issue which is not in your original fish repo, but is regarding loading BitmapFonts and the XMLDocument class.

PIXI is checking that the response data of a .fnt file is an instance of XMLDocument here: https://github.com/pixijs/pixi.js/blob/dev/packages/text-bitmap/src/formats/XMLFormat.ts#L21

But this evaluates to false, even though the data has been successfully parsed and the next 2 conditions actually evaluate to true: data.getElementsByTagName('page').length && data.getElementsByTagName('info')[0].getAttribute('face') !== null;

I've created a fork of fish with a BitmapFont added, see the relevant log here: https://github.com/bamsarker/fish/blob/master/src/scenes/prepare.js

bamsarker avatar Jul 30 '20 16:07 bamsarker

If you want to use BitmapFonts in a Wechat or QQ environment, you may need to fully emulate the XMLDocument implementation, which is a bit too much work.

In @iro/wechat-adapter I just defined XMLDocument so that the program doesn't report errors, use other ways instead of BitmapFonts would be a better choice.

JetLua avatar Jul 30 '20 16:07 JetLua

Oh, not exactly. You can use FNT instead of XML.

JetLua avatar Dec 04 '20 09:12 JetLua