r103 breaks my plugin tutorial demo (ctx is null)

0 favourites
  • 3 posts
From the Asset Store
$4.75 USD
5% off
Demo Game Multiplayer Online with member registration system
  • I created my (prize-winning <img src="smileys/smiley2.gif" border="0" align="middle"> ) plugin tutorial using stable release r95. Running it with WebGL switched on (the default) under the latest stable release (r103.2) now produces a JavaScript error ("Type error: ctx is null"). Here's how it happens:

    In order to keep things as simple as possible, I simply had a call to instanceProto.drawGL() fall through to instanceProto.draw(), passing this.runtime.overlay_ctx as the context (I'd pinched this code from shinkan's Square plugin):

    instanceProto.drawGL = function (glw) {

    However, since r103.2 (or possibly before - I didn't test it with the intervening beta releases), runtime.overlay_ctx returns null.

    In any case, when I think about it, overlay_ctx is probably not the right context to be using - my guess is that this creates a second canvas context that simply (no surprise!) overlays the main canvas. What is needed is a reference to the context of that main canvas.

    So my question is: how can I access the context that is passed (as ctx) to draw() ? (The answer may be in the SDK manual, but I haven't been able to find it.)

  • The overlay context was removed recently. You should not use it - it was only ever there as a hack to support the Text object, and then when we implemented Text properly to avoid the hack the additional context was removed. You need to implement an actual WebGL drawing routine.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ashley

    Thanks for your helpful reply - and for confirming my suspicions about the overlay context.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)