here's a OGG Video of the free space grid window-manager-placement algorithm code doing it's stuff.
the grid is 128 x 128 elements. unused space (free space) in the grid is represented by a ' ' (space) character, and used space is represented by a '#' character. besides the 'freespace_grid' data structure, another data structure 'boundary_grid' is used to mark out (a) boundary(ies) within the grid where unused space is removed - or converted - to used space. the function to remove free space and mark it as used space has the grid data structure passed to it, a boundary, plus, the width and height of the area to remove/convert, and finally, most importantly, pointers to two variables where it shall store the coordinates it found where an area of width and height was available to be converted to used space. in the test program, of which the video shows the product of, 5 boundaries are in use. the first four are 56 x 56 and equally spaced within the grid in each of it's corners. the top two boundaries uses row-smart placement, the bottom two use column-smart placement. additionally, the left two boundaries use left-to-right placement, while the right two use right-to-left placement. finally blah, blah, blah, the bottom two use bottom-to-top instead of like the top two using top-to-bottom. the fifth boundary you'll be able to tell what it's doing... in the test program is a loop which iterates 3000 times. on each loop iteration, free space is removed from each of the 5 boundaries, and the coordinates and dimensions are stored. after 500 iterations it stops removing free space, only to resume again after 750. simultaneously, after the first 500 iterations, the free space that was removed is put back into the grid (disconnected from boundaries). also, after about 1000 iterations of the loop, the maximum random sizes of the areas removed is gradually increased every so often until it gets to a size where very little is removed because not enough space of that dimension is available. http://jwm-art.net/art/freespace_grid.ogv it has a superbly retro feel. because of various factors, the video is an odd size, around 650 x 920, hope this presents no problems :| please not ths is just one small piece of a larger program that this forms a very important part of. jmames. _______________________________________________ NetBehaviour mailing list [email protected] http://www.netbehaviour.org/mailman/listinfo/netbehaviour
