Hello, im trying to draw dozens of sprites of the same texture - but i dont know how (when im using classes and objects) load texture just once and use it for all my sprites...
I tried static texture but compilator doesnt like it:
1>project2.obj : error LNK2001: unresolved external symbol "private: static class sf::Texture solder::imageSource" (?imageSource@solder@@0VTexture@sf@@A)
1>C:\Users\.\documents\visual studio 2010\Projects\project2\Release\project2.exe : fatal error LNK1120: 1 unresolved externals
here is my code:class car{
public:
void set_up(){
if(!source.loadFromFile("Untitled.png"));
}
car(){
sprite.setTexture(source);
}
~car(){}
private:
static sf::Texture source;
sf::Sprite sprite;
}
thans for help.
car.hpp
class car
{
static sf::Texture source;
};
car.cpp
sf::Texture car::source;
Doesn't teach you anything, but at least you've got the solution and you'll stop asking... for now.