This is for a project but i’m currently in a little oh cock moment.
My aim is to make a tessellator. Where you click on a small grid and that pattern tesselates on a bigger grid. the problem i’m having is that i don’t know how to update the array that has zeros and one’s that represent black and white.
Tessellator Viewer:
Model myModel;
void setup() {
size(1300, 600);
background(255);
myModel = new Model();
}
void draw() {
myModel.myPattern();
}
TessalatorControler (this section is what i’m stuck on):
class control {
void draw() {
update(mouseX, mouseY);
if()
}
void update(int x, int y) {
}
void mousePressed() {
}
}
TessalatolModel:
class Model
{
void myPattern() {
mydraw(1, 1, 0);
for (int i = 0; i<10; i++) {
for (int j = 0; j<10; j++){
mydraw(i,j, 200);
}
}
}
int [][] myData ={
{0, 0, 0, 0, 0 },
{0, 1, 1, 1, 0 },
{0, 1, 0, 1, 0 },
{0, 1, 1, 1, 0 },
{0, 0, 0, 0, 0 }
};
void mydraw(int x, int y, int offset)
{
for (int i = 0; i<myData.length; i++)
{
for (int j = 0; j<myData.length; j++)
{
if (myData[i][j] == 1)
fill(0, 0, 0);
else
fill(255);
rect(i*12+(x*60)+offset, j*12+(y*60), 10, 10);
}
}
}
}