I don t understand why isn't working,I think is a problem with the draw and setup function.Here is the full code:
function setup() {
var height = 400;
var length = 400;
createCanvas(length,height);
textSize(50);
}
function draw() {
background(224,224,224);//grey_color
var vx1 = 0;
var vy1 = 0;
var vx2 = 0;
var vy2 = 400;
//vertical
for (i = 0 ; i < 5 ; i++){
line(vx1,vy1,vx2,vy2);
stroke(40);
if(i == 1 || i == 3 ){
strokeWeight(10);
}
else {
strokeWeight(4);
}
vx1 += 100;
vx2 += 100;
}
var ox1 = 0;
var oy1 = 0;
var ox2 = 400;
var oy2 = 0;
//orizontal
for (i = 0 ; i < 5 ; i++){
line(ox1,oy1,ox2,oy2);
stroke(40);
if(i == 1 || i == 3 ){
strokeWeight(10);
}
else {
strokeWeight(4);
}
oy1 += 100;
oy2 += 100;
}
text('3', 33, 65);//1
text('4', 233, 65);//2
text('1', 133, 165);//3
text('3', 333, 165);//4
text('2', 33, 265);//5
text('3', 133, 265);//6
text('1', 33, 365);//7
text('2', 333, 365);//8
//nr_sudoku
if(mouseX > 100 && mouseX < 200 && mouseY < 100)
{
cursor(CROSS);
}
//1
else if(mouseX > 300 && mouseX < 400 && mouseY < 100)
{
cursor(CROSS);
}
//2
else if( mouseX < 100 && mouseY > 100 && mouseY < 200)
{
cursor(CROSS);
}
//3
else if( mouseX > 200 && mouseX < 300 && mouseY > 100 && mouseY < 200)
{
cursor(CROSS);
}
//4
else if( mouseX > 200 && mouseX < 400 && mouseY > 200 && mouseY < 300)
{
cursor(CROSS);
}
//5
else if( mouseX > 200 && mouseX < 400 && mouseY > 200 && mouseY < 300)
{
cursor(CROSS);
}
//6
else if( closed > 100 && mouseX < 300 && mouseY > 300 && mouseY < 400)
{
cursor(CROSS);
}
//7
else {
cursor('grab');
}
}//draw_fct
function mousePressed() {
text('A', 10, 10);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.3/p5.js"></script>
I tried a lot of things but is the same result