36


void setup(){
size(400,400);
}

void draw(){
//constrain to not exceed the boundary of the arry
if(mousePressed){
drawten();
}
}

void drawten(){
int mx = constrain(mouseX,0,width);
int my = constrain(mouseY,0,height);
loadPixels();
pixels[my*width+mx] = color(255);
updatePixels();
}

コメント