You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Layers should have a member that allows setting/getting of their current height/width (Scale alone just doesn't do the trick, it needs at least a second attribute that'd be width/height BEFORE scaling).
This would allow for more precise sizing of elements relative to others, more precise positioning relative to the size of the elements they interact with... etc.
This is especially important since cocos2d doesn't seem to have any layouts (though layouts would be unsufficient by themselves to solve this problem).
Is it possible to adress the problem without breaking the current architecture ?
Versions used in the stackoverflow snippet :
cocos2d v0.6.4
pyglet v1.2.4
The text was updated successfully, but these errors were encountered:
After reading the Stack Overflow post, I think you meant Label and not Layer.
Layer don't have a concept of width or height. You could actually imagine that they have an infinite width and height. They just have a position. All CocosNode children will be positioned relative to their own position.
In the example you showed, the Layer has two children, both a Label instance. In order to position the second Label in relation with the first Label you might want to know its width.
As explained in the documentation, cocos.text.Label is just a wrapper around a pyglet Label. The information regarding the width of the Label is as such contained in the underlying Label that you can find under the attribute element.
As from
http://stackoverflow.com/questions/41831063/how-to-find-layer-width-height-with-cocos-python
Layers should have a member that allows setting/getting of their current height/width (Scale alone just doesn't do the trick, it needs at least a second attribute that'd be width/height BEFORE scaling).
This would allow for more precise sizing of elements relative to others, more precise positioning relative to the size of the elements they interact with... etc.
This is especially important since cocos2d doesn't seem to have any layouts (though layouts would be unsufficient by themselves to solve this problem).
Is it possible to adress the problem without breaking the current architecture ?
Versions used in the stackoverflow snippet :
cocos2d v0.6.4
pyglet v1.2.4
The text was updated successfully, but these errors were encountered: