label and background color

Started by billarhos, 29 October 2015, 18:30:29

billarhos

Hi (again)

well now i face something different. My label has a background color. 

pLabel->getRenderer()->setBackgroundColor(sf::Color(150, 150, 150, 255));

When the label has text to print the background color is visible. When the text is null the background color disappears! 


texus

Did you give the label a size? If you don't call setSize it will auto-size to be as large as the text, if there is no text then there will be no label.

billarhos

I have set size and in advance i have set autosize to false.




texus

This was caused by an optimization that was made before label supported a background color. The draw function literally started with this:
Code (cpp) Select
if (m_text.getString().isEmpty())
    return;


Fixed on github.