Multiple images in a single jit.window

Dan Laüt's icon

Still working on the shift-puzzle project, see earlier posts.

Concept:
A grid of variable dimensions (min 2 x 2, which is trivial of course). The cells ('tiles') are numbered 0 to (width x height)-1.
The zero tile is the empty place or 'shift spot'. Only tiles sharing a side with it can move.

jit.cellblock

After a move, the new ordering is passed as a list to a sub displaying it in a jit.cellblock.

The next step is to display the tiles as images using jit.matrix. Specifically, I want to use Trebuchet tiles,

to represent even or odd numbers and combined to represent the shift spot.

I'm stuck here. How to subdivide the matrix into cols x rows regions, each with its own source, so that the entire thing is displayed in a single window?

TFL's icon

Just found this Truchet tiles example in the forum. It's implemented in jit.gl.pix but you can definitely port it to jit.gen if you prefer.

It provides all the logic to draw a repeated pattern into a grid.

Dan Laüt's icon

Very enlightening! Thanks, TFL!
I'll start with taking the 'eb' out.

Dan Laüt's icon

The path of life consists of side tracks,. TFL's response does not answer my question, but it did open my eyes to a lot of Truchet-related math. Playing with that, I had an epiphany:

Max Patch
Copy patch and select New From Clipboard in Max.

Very basic, but just what I need in this context.

Rob Ramirez's icon

just to throw another log on the fire, and if you need a method that uses relative values rather than pixel coords you can use jit.gl.videoplane for this

Max Patch
Copy patch and select New From Clipboard in Max.