jCanvas

0 favourites
  • 4 posts
  • calebevans.me/projects/jcanvas/index.php

    I would like to use jCanvas to draw shapes at both edit time and run time. I tried just copying and pasting the minified code into the common.js file, but got this error:

    ---------------------------

    HTML5 exporter

    ---------------------------

    Unable to load plugin in 'C:\Program Files\Construct 2\exporters\html5\plugins\zui_rectangle\': Javascript exception in file 'common.js' line 8: ReferenceError: jQuery is not defined

    Code line:

    tContext!=null);r(d);A.defaults=p;A.prefs=j;A.extend=B;k.jCanvas=A}(jQuery,doc

    Stack trace:

    ReferenceError: jQuery is not defined

        at common.js:8:12841

    This plugin will not be available in the editor.

    ---------------------------

    OK   

    ---------------------------

                

    How would I get jCanvas to work?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It sounds like some kind of reference to jQuery gets passed as a parameter there, and I believe C2 object sealing prevents the usage that is done in the library you add.

    It's a wild guess, but I believe posting the whole files would help to make sure the integration was made correctly.

    More about object sealing and jQuery usage in the SDK.

    As a solution, you might also want to take a look at R0j0hound's canvas plugin which should allow you drawing of basic shapes as you're aiming for.

    I'm not sure it's a jCanvas (more like a regular <canvas>) but it should do the trick.

  • You cannot use browser technologies like jCanvas to render in the edittime. The edittime is a pure javascript context - there is no browser, DOM, window, document or anything, nor can you create canvases, divs or anything like that. For that reason, there's also no jQuery in the edittime scripts. jQuery is only provided for the runtime scripts.

    So pasting code using a browser or jQuery in to common.js will also paste it in to edittime.js where it won't work. Just paste it in to runtime.js.

  • Ok then, how can I render rounded rectangles, gradients, and outlines with a thickness other than 1px in edit time?

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