Hi I have a vector of sprites created in real-time and they are added to it (to be more specific instantiating bullets) and every one of the uses the same texture created in a constructor of another class that contains them, the texture is fine because when I use it on static sprites it works fine, but this array of sprites refuses to get any texture what so ever and stays white all the time.
Any help is appreciated.
EDIT:I even tried to put the texture in main() before the main loop and assign it to every bullet before drawing it, same thing. I'm afraid this is a bad bug.
void PlayerSpaceShip::DrawBullets(sf::RenderWindow &win)
{
for(int i = 0;i < bulletShot.size();i++)
{
bulletShot[i].Draw(win);
}
}
void Projectile::SetPosition(int x, int y)
{
m_sprite.setOrigin(m_sprite.getLocalBounds().width/2,m_sprite.getLocalBounds().height/2);
m_sprite.setPosition(x,y);
}
void Projectile::SetTexture(sf::Texture texture)
{
m_sprite.setTexture(texture);
}
void Projectile::Draw(sf::RenderWindow &win)
{
win.draw(m_sprite);
}
void Projectile::Move()
{
m_sprite.move(direction);
}