[MGraphics] no jgraphics context

KrisW's icon

Hello there !

why im getting this error ? i cant call or paint within a custom function ?

mgraphics.init();
mgraphics.relative_coords = 1;
mgraphics.autofill = 0;
function paint() {
    with(mgraphics){
    mgraphics.rectangle(-.1, .1, .2, -.2);
    mgraphics.fill();
    }
}
function nofill(){
    with (mgraphics){
    rectangle(-.2, .2, .2, -.2);
    redraw();
    }
}
KrisW's icon

Im only allowed to redraw with provided variables through paint() function only ?

Emmanuel Jourdan's icon

That is correct.

KrisW's icon

and thats not a problem :) im just worrying about further performance if i need to always redraw all of the elements . Thanks