@ Chrisir
hi
how are you
int unit = 90;
int count;
Module[] mods;
void setup() {
size(600, 660, OPENGL);
noStroke();
int wideCount = width / unit;
int highCount = height / unit;
int depthCount = highCount;
count = wideCount * highCount * depthCount;
mods = new Module[count];
int index = 0;
for (int z = 0; z < depthCount; z++) {
for (int y = 0; y < highCount; y++) {
for (int x = 0; x < wideCount; x++) {
if (z==0||y==0||x==0||
z==depthCount-1||y==highCount-1||x==wideCount-1)
mods[index++] = new Module(x*unit+200, y*unit+600, z*unit-800, true);
else
mods[index++] = new Module(x*unit+200, y*unit+600, z*unit-800, false);
}
}
}
}
void draw() {
background(0);
//ortho();
rotateY (.4);
for (int i = 0; i < count; i++) {
mods[i].draw();
}
}
class Module {
int xOffset;
int yOffset;
int zOffset;
float x, y;
color col = color(random(255), random(255), random(255));
boolean exist = false;
// Contructor
Module(int xOffsetTemp, int yOffsetTemp, int zOffset, boolean existTemp) {
xOffset = xOffsetTemp;
yOffset = yOffsetTemp;
this.zOffset = zOffset;
exist = existTemp;
}
// Custom method for drawing the object
void draw() {
if (exist) {
noFill();
stroke(255);
strokeWeight(0.3);
pushMatrix();
fill(col);
translate(xOffset, yOffset, zOffset);
box(unit);
popMatrix();
}
}
}
this is your sketch if you kind i want to make grid of boxes instead of rects and what i need is control boxes numbers in each raw and column and the sizes of the box like this sketch which is yours also
// GRID array of a class
int grid=5, // how many cells per row and column
many=grid*grid; // how many in total
Button [] myButtons = new Button [many];
void setup() {
size (600, 600);
int x=40, y=x, // dist from screen border
w=100, h=w, // width and height of one cell
off=5; // dist between cells
int k=0;
for (int i = 0; i < grid; i++) {
for (int i2 = 0; i2 < grid; i2++) {
myButtons [k] = new Button ( x+ i *( w+off), y+ i2 *(h+off),
w, h,
int(random(255)),
25 ); // 25 = size
k++;
}
}
}
void draw() {
background (255);
for (int i = 0; i < many; i++)
myButtons[i].display();
}
i just want grid with boxes with out mouse or color stuff
boxes with raw and column not cubic grid
if you kind help if you can thanks in advance