title: How to call on a function found on another file?
body: <p>I'm recently starting to pick up C++ and the SFML library, and I was wondering if I defined a Sprite on a file appropriately called "player.cpp" how would I call it on my main loop located at "main.cpp"?</p>
  
  <p>Here is my code (Be aware that this is SFML 2.0, not 1.6!).</p>
  
  <p>main.cpp</p>
  
  <pre><code>#include "stdafx.h"
  #include &lt;SFML/Graphics.hpp&gt;
  #include "player.cpp"
  
  int main()
  {
      sf::RenderWindow window(sf::VideoMode(800, 600), "Skylords - Alpha v1");
  
      while (window.isOpen())
      {
          sf::Event event;
          while (window.pollEvent(event))
          {
              if (event.type == sf::Event::Closed)
                  window.close();
          }
  
          window.clear();
          window.draw();
          window.display();
      }
  
      return 0;
  }
  </code></pre>
  
  <p>player.cpp</p>
  
  <pre><code>#include "stdafx.h"
  #include &lt;SFML/Graphics.hpp&gt;
  
  int playerSprite(){
      sf::Texture Texture;
      if(!Texture.loadFromFile("player.png")){
          return 1;
      }
      sf::Sprite Sprite;
      Sprite.setTexture(Texture);
      return 0;
  }
  </code></pre>
  
  <p>Where I need help is in the <code>main.cpp</code> where it says <code>window.draw();</code> in my draw code. In that parenthesis, there should be the name of the Sprite that I want to load onto the screen. As far as I've searched, and tried by guessing, I have not succeeded into making that draw function work with my sprite on the other file.
  I feel like I'm missing something big, and very obvious (on either files), but then again, every pro was once a newb.</p>