I can’t right now but maybe later.
The idea is simple though. I have a subclass of
Node that upon creation takes an enum which will set the anchorpoint accordingly. But without a content size this means nothing, I suppose. So I wonder how to solve that.
I have a class called
Board, which contains
Frame and that in turn contains
Grid. So I will have a grid in a frame, which is the play area, so that when I add children to the grid using my helped function
placeNodeInSquare(int row, int col) it will do the calculations to handle that.
The problem is that the nodes themselves that are put in there have no width or height right now (as I have no assets for them currently. They’re just blocks/objects on the map), so instead of ending up inside the square, they end up crossing over four squares, as their anchorpoint is still
(0, 0) instead of
(0.5, 0.5). Which makes sense if this has to do with the content size.
So I need to know how to work around it for now. I do however know the size of a square, so I could maybe do
node->setContentSize(squareSize) if that will help?