I used an approach where my rendering engine works like this:
Using a Group “Board”
Using a Group “Grid”
Using 25 Groups “Cell”
Using a Group “Borders”
The setup works like creating a “Board”
Adding an Rectangle as Background
Greating the “Grid” Group and adding 5 x 5 Cell Groups and setting their x,y to the right offset in the Board (think Checkerboard).
Then it overlays those Grid cells by adding Lines to the “Grid” Group “above” the Cells (which are groups)
The final rendering works like this:
Render all 25 Cells one by one (setting a Rect for Background and put texts inside). This is only done for Cells which need to change.
Render some Borders for grouped cells in the “Borders” group (Boarders are framewise animated, cells change infrequent)
Then inserting the Grid in the Board … then the Border into the Board… Done
All this works…
Here the “Problem”…
The Stage Coordinate are all fucked up if I insert those “Cell” Groups as empty Groups! I need to place something in them before adding them. Which is ok to do but I think a Cell should have a with/height of 0 if nothing is inside.
As it is now I get something like this for the stageBounds
table: 0x3ecac0 {
[xMin] => 11
[xMax] => -2147483648
[yMax] => 3368
[yMin] => 119
}
After all the rendering is looking correctly. I did not even noticed that before trying to translate screen locations to the cell coordinates in the object.
When I add 1 pixel big rect before adding the individual cells into the grid group I get this (expected) result!
table: 0x6e7190 {
[xMin] => 11
[xMax] => 310
[yMax] => 418
[yMin] => 119
}
Btw. I use those individual “Cell” groups to track what to “remove” from the stage when their content changes. I also like the idea of animating them later individually (like shake one when updated)
Does that make sense!?
Did I miss something?
Is it just “wrong” to add groups to groups while they are empty!?
Can I specify the size of a group without rendering something into it?
[import]uid: 6928 topic_id: 1173 reply_id: 301173[/import]
