Hello everyone.
I am still a beginner on sfml. But I was wondering if there's a way to separate all the messy texture.loadFromFile("picture") with the rest of the code. Because Main.cpp is getting overloaded with this:
sf::Texture texGoomba;
sf::Sprite sprGoomba;
if (!texGoomba.loadFromFile("goomba.png"))
std::cout << "Error: goomba.png could not load" << std::endl;
sprGoomba.setTexture(texGoomba);
sprGoomba.setPosition(0,0);
So I tried putting all of that on to resource.cpp as a static member function,
//resource.cpp
void CResource::loadGoomba()
{
sf::Texture texGoomba;
...
}
Though it's loaded on resource.cpp, main.cpp doesn't seem to recognize sprGoomba.
Well, if there's any better way to do this, any help would be appreciated.