Open ewal opened 4 months ago
@ewal This is a great feature idea! I 100% support this
@ewal As a possible workaround you can supply the canvasElementId
to the engine constructor and it will use a canvas that is defined in the DOM
@ewal As a possible workaround you can supply the
canvasElementId
to the engine constructor and it will use a canvas that is defined in the DOM
Thanks for the reply, @eonarheim. I tried specifying the canvasElementId
but I still face the same problem since the code tries to find the element on line 760 in Engine.ts with the document
being undefined.
@ewal AH! Good find, that definitely is a bigger problem for sure. I'll bump this in priority on my list!
This issue hasn't had any recent activity lately and is being marked as stale automatically.
Context
When creating a new instance of the Engine the canvas element is automatically injected into the DOM and this behavior can cause problems if the document is not yet ready.
Proposal
By allowing manual mounting/injecting of the canvas element, we will have more control of the flow, eg.the game could be constructed before being used.
I ran into the problem with the document not being ready when wanted to prepare an exported game instance.