Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [Solved]Namespace to load in textures  (Read 1717 times)

0 Members and 1 Guest are viewing this topic.

GAMINGBACON97

  • Newbie
  • *
  • Posts: 42
    • View Profile
    • Email
[Solved]Namespace to load in textures
« on: September 14, 2015, 01:47:54 am »
Hi, I'm trying to make a namespace that can load in textures, I have made it load in sf::music, but I can't make it load in textures because it gives me an error saying no suitable conversion from sf::texture to const sf::texture exists here is my code:
//other namespace stuff
namespace Resource {
 static void loadTextureFromFile(sf::Texture& Texture, std::string FileName){
        if (!Texture.loadFromFile(FileName)){
            std::cout << "ERROR could not load " << FileName << std::endl;
        }
        else{
            std::cout << "Loaded" << FileName << std::endl;
        }
    }
//other namespace stuff
}
sf::RectangleShape MShape;
    Resource::loadTextureFromFile(MenuBackGround, "Background.jpg");
    MShape.setTexture(MenuBackGround);//error line
 
 
thanks in advance!!!
« Last Edit: September 14, 2015, 05:17:19 am by GAMINGBACON97 »

GAMINGBACON97

  • Newbie
  • *
  • Posts: 42
    • View Profile
    • Email
Re: [Solved]Namespace to load in textures
« Reply #1 on: September 14, 2015, 05:17:56 am »
I found this out by going to a Twitch.Tv livetsream and asking some one, I forgot to reference it with &