I'm trying to create a label that will automatically centre itself. I'm attempting to do this:
So no matter what I set the text to, in theory, the width should adjust accordingly, and then the position should change based on the width.
However, it seems that bindWidth(label) isn't updating when the length changes, and label has no text value until I change it, bindWidth(label) is always 0.
In the image "Get Ready!!!" is the label.
Any ideas? The width is changing correctly but that doesn't seem to affect the binding.
Code Select
label->setAutoSize(true);
label->setPosition(screenSize.x / 2.f - bindWidth(label)/2.f, YVALUE);
So no matter what I set the text to, in theory, the width should adjust accordingly, and then the position should change based on the width.
However, it seems that bindWidth(label) isn't updating when the length changes, and label has no text value until I change it, bindWidth(label) is always 0.
In the image "Get Ready!!!" is the label.
Any ideas? The width is changing correctly but that doesn't seem to affect the binding.