I am making an sfml framework, in the framework there is a makeSpr() function. The function has the normal code for creating a sprite inside of it, but draws a white square. I have used the texture on a different sprite, which isn't drawn using the function. It draws it normally.
makeSpr() function:
sf::Sprite makeSpr(sf::Texture tex, int x,int y, int sizeX,int sixeY) {
sf::Sprite spr;
spr.setTexture(tex);
spr.setScale(sizeX,sizeY);
spr.setPosition(x,y);
return spr;
}
Use of makeSpr to assign it to a Sprite ():
sf::Sprite sprTest = makeSpr(texTxtBox, 100,100, 5,5);
Drawing the sprite in the main loop between window.clear() and window.diplay()
window.draw(sprTest);
The texture works well if I draw it normally without the framework.
sf::Sprite sprTxtBox;
sprTxtBox.setTexture(texTxtBox);