Hi,
I found something odd about RectangleShape that I'm not sure if I should report as a bug.
After calling setSize and setPosition (example below)
sf::RectangleShape m_healthbar;
m_healthbar.setSize(sf::Vector2f(m_bounding_box_width * .7f, m_bounding_box.getSize().y * .1f));
m_healthbar.setPosition(m_xpos +
(m_bounding_box_width * .025f) +
(m_healthbar_label_text.getLocalBounds().width) +
10
, m_ypos + (m_bounding_box_height * .025f) + m_font_size + 5);
auto dbx = m_healthbar.getPosition().x; // This returns 1620.59998, which is what I want
auto dby = m_healthbar.getPosition().y; // This returns 151.00000, which is what I want
auto dbl = m_healthbar.getLocalBounds(); // This returns left and top each as 0, seems wrong?
auto dbg = m_healthbar.getGlobalBounds(); // This returns left as 1620.59998
//and top as 151.00000, which is perfect
I don't understand why getLocalBounds is returning left and top each as 0. Later in the code I tried to use getLocalBounds to get the position of the shape and it didn't work because it was returning 0 for left and top. After switching to getGlobalBounds it started working the way I wanted.
Thank you!