Reloading a wasm game doesn't show anything on the canvas (No erros on console).
Currently I'm trying to host on my site (made with Nuxt) a small game I made using macroquad 0.3 and compiling to wasm.
I load the mq_js_bundle.js (this version in particular) and everything works great. However, the component showing the game is unmounted once you close it, and when opening it again, after calling the load function the game appears to instantiate (I can see the requests for assets in my network panel) but the canvas doesn't show anything and I see no errors on the console. Is there any way to debug this?
I noticed that on the examples page games are shown with an iframe which would give a new context every time, but also download the mq_js_bundle.js every time. My idea was to lazy load the js file only once, and then call load every time it was needed. Is this way not supported?
Is this way not supported?
Yes, not supported :( load was never designed to be called twice.
Is there any way to debug this?
I am not really sure how to debug this, but my wild guess - is some JS globals are being initialized twice without being properly de-initialized. If I'll need to debug this - I would probably start with tracing what wasm functions are being called on the second "load" and what is the difference with the first load.