not sure quite how to even phrase this question but i’m trying to use the clip function and it works fine on local processing, but in my live html canvas (with processing.js) invoking it in any capacity, even just using noClip(); immediately breaks the program. no error no way to debug it at all. it’s definitely clip that’s doing this. any guidance? thanks
here’s some relevant code:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>pde test</title>
<script type="text/javascript" src="processing.js"></script>
<link rel="stylesheet" href="index.css">
</head>
<body>
<canvas data-processing-sources="topdown_engine.pde camera.pde grid.pde scene.pde tile.pde sprite.pde"></canvas>
</body>
</html>
/* @pjs preload="data/tall_tex.png"; */
Scene scene;
int TICK;
void setup(){
size(750,750);
noClip(); //adding this line makes the canvas immediately go blank, commenting it out fixes it
noSmooth();
colorMode(HSB);
loadTextures();
TICK = 0;
scene = new Scene();
}
void draw(){
runGameTEMP();
noSmooth();
image(scene.render(500,500),0,0,width,height);
TICK++;
}
void runGameTEMP(){
//scene.mainCam.x=(mouseX-width/2)/55.0;
//scene.mainCam.y=(height/2-mouseY)/55.0;
//scene.mainCam.x=sin(TICK*0.05)*2;
//scene.mainCam.y=cos(TICK*0.025)*2;
if(mousePressed){
float[] mpos = scene.mainCam.tileAt(mouseX*((float)scene.mainCam.pw/width),mouseY*((float)scene.mainCam.ph/height),0);
scene.player.x=mpos[0];
scene.player.y=mpos[1];
}
for(int i = 1;i < scene.sprites.size();i ++){
scene.sprites.get(i).z=sin(TICK*0.025)+0.5;
}
scene.mainCam.x+=(-scene.player.x-scene.mainCam.x)*0.025;
scene.mainCam.y+=(-scene.player.y-scene.mainCam.y)*0.025;
}
here’s what my canvas looks like when i invoke clip
do i just need to import this somehow? it’s like it doesn’t recognize it at all. again this works totally fine in a local processing sketch, just not in html