hi
i have an object drawable with 5 sf::Sprite and a bitmapText
i did first this draw function before i tried to make the object drawable
void BottomPanel::draw()
{
for(auto i = 0; i < 5; ++i) {
m_window.draw(*m_sprites[i]);
}
m_window.draw(m_Text);
}
}
was good, tranformation are drawn good
now i have this
void BottomPanel::draw(sf::RenderTarget& target, sf::RenderStates states) const
{
for(auto& elem : m_sprites) {
states.transform *= elem->getTransform();
states.texture = elem->getTexture();
target.draw(*elem, states);
}
states.transform *= m_Text.getTransform();
states.texture = m_Text.getTexture();
target.draw(m_Text, states);
}
i have a problem with the states.transform *= m_Text.getTransform();
sprites are not drawn where it should be
it's ok if i remove these 2 lines
how do I "fix" a position coords for my object, then i can adapt sprites coords by this origin ?
the contained objects are sf::Transformable so if i set a rotation it s drawn good without
states.transform *= m_Text.getTransform();
so do i need to get transform or not ?
same with textures ?
draw what i want with that one
void BottomPanel::draw(sf::RenderTarget& target, sf::RenderStates states) const
{
for(auto& elem : m_sprites) {
target.draw(*elem, states);
}
target.draw(m_Text, states);
}
thx