title: C++ SFML Sprite not being drawn through classes
body: <p>(No, I do not mean the very basics of displaying a sprite. I simply could not think of a better title since I do not fully understand what is going wrong.)</p>
  
  <p>Simply put, I have a sprite that, when being drawn to the screen, will not show up, but if I do some tests by making temporary sprites in <code>int main()</code> and draw them to the screen, they show up perfectly fine.  So I know that I am doing something wrong with the design of my classes or something because they are where the sprites will not show.</p>
  
  <p>(note: all of my classes are under the namespace of <code>rpg::</code> I will cut it out to save space, but I might use it in my code without thinking - so to remove any confusion that might happen)</p>
  
  <p>Code:</p>
  
  <p>rpg.h:</p>
  
  <pre><code>static sf::Texture PlayerTexture;
  
  /*
      NOTE: Loads in All Textures for use
            --This works properly (tested)
  */
  static void SetUp()
  {
      if(!PlayerTexture.loadFromFile("C:/Program Files (x86)/Terentia/Files/Textures/player.png"))
      {
          std::cout&lt;&lt;"Error: texture failed to load..."&lt;&lt;std::endl;
      }
  }
  </code></pre>
  
  <p>AbstractComponents.h</p>
  
  <pre><code>//Abstract class for handling graphics
  class GraphicsComponent : public rpg::Component, public sf::Drawable
  {
  protected:
      sf::Sprite mySprite;
  
  public:
      virtual void HandleEvents(GameObject&amp; object, sf::RenderWindow&amp; screen, rpg::EventList&amp; events) = 0;
  
  //Copy Constructor
  GraphicsComponent(const GraphicsComponent&amp; me) {
      mySprite = me.mySprite; }
  
  GraphicsComponent&amp; GraphicsComponent::operator= (const GraphicsComponent &amp;me){
      mySprite = me.mySprite; }
  
  GraphicsComponent() {}
  virtual ~GraphicsComponent() {}
  };
  </code></pre>
  
  <p>PlayerGraphicsComponent.h</p>
  
  <pre><code>class PlayerGraphicsComponent : public rpg::GraphicsComponent
  {
  
  public:
  
  virtual void Receive(rpg::Message message);
  
  virtual void HandleEvents(GameObject&amp; object, sf::RenderWindow&amp; screen, rpg::EventList&amp; events);
  
  PlayerGraphicsComponent() { mySprite.setTexture(rpg::PlayerTexture); }
  ~PlayerGraphicsComponent();
  
  private:
  virtual void draw(sf::RenderTarget&amp; target, sf::RenderStates states) const
  {
      //Draw sprite onto the screen.
      target.draw(mySprite, states);
  
  }//needed to make drawable
  };
  </code></pre>
  
  <p>GameObject.h</p>
  
  <pre><code>class GameObject : public rpg::ContainerObject, public sf::Drawable
  {
  public:
  sf::Vector2f myPosition;
  
  rpg::Movable CanMove;
  
  GameObject();
  GameObject(std::shared_ptr&lt;InputComponent&gt; input,
              std::shared_ptr&lt;GraphicsComponent&gt; graphics,
              std::shared_ptr&lt;PhysicsComponent&gt; physics )
  :   myInput(input),
      myGraphics(graphics),
      myPhysics(physics)
  {myPosition.x = 0;
  myPosition.y = 0;}
  
  //Copy Constructor
  GameObject(const GameObject&amp; me) {
      myInput = me.myInput;
      myGraphics = me.myGraphics;
      myPhysics = me.myPhysics;
      myPosition = me.myPosition; }
  
  GameObject&amp; GameObject::operator= (const GameObject &amp;me);
  
  ~GameObject();
  
  void HandleEvents(sf::RenderWindow&amp; screen, rpg::EventList&amp; events)
  {
      myInput-&gt;HandleEvents(*this, screen, events);
      myPhysics-&gt;HandleEvents(*this, screen, events);
      myGraphics-&gt;HandleEvents(*this, screen, events);
  }
  
  private:
  std::shared_ptr&lt;InputComponent&gt;     myInput;
  std::shared_ptr&lt;GraphicsComponent&gt;  myGraphics;
  std::shared_ptr&lt;PhysicsComponent&gt;   myPhysics;
  
  
  private:
  virtual void draw(sf::RenderTarget&amp; target, sf::RenderStates states) const
  {
      target.draw(*myGraphics, states);
  
  }//needed to make drawable
  };http://stackoverflow.com/questions/13899077/c-sfml-display-glitch-with-sprite-member-changed-by-mouseclick
  </code></pre>
  
  <p>main.cpp</p>
  
  <pre><code>int main()
  {
  //Loads in all textures, info, etc
  rpg::SetUp(); 
  
  //Create Player Object
  ptrGameObject player = rpg::CreatePlayer();
  
  //Create render window and give it it's info
  sf::RenderWindow screen;
  screen.create(sf::VideoMode(800, 640), "Terentia", sf::Style::Close);
  
  screen.setVerticalSyncEnabled(1); // Setting max framerate to 60 (Facultative)
  screen.setFramerateLimit(60); // Setting max framerate to 60 (Facultative)
  
  rpg::EventList eventList;
  
  while(screen.isOpen())
  {
      sf::Event events;
      while(screen.pollEvent(events))
      {
          eventList.push_back(events);
          if (events.type == sf::Event::Closed)
          {
              screen.close();
          }
      }
  
      //Handle Object Events here
          player-&gt;HandleEvents(screen, eventList);
      //End Object Handle Events
  
      eventList.clear();
  
      //temp sprite for test
      std::shared_ptr&lt;sf::Sprite&gt; tempSprite(new sf::Sprite());
  
      tempSprite-&gt;setTexture(rpg::PlayerTexture);
  
      screen.clear();
  
      //Doesn't draw to screen
      screen.draw(*player);
  
      //Does draw to screen.
      screen.draw(*tempSprite);
  
      screen.display();
  
  }
  
  return 0;
  }
  </code></pre>
  
  <p>I know there is a ton of code here, but I believe that at least most of it is relevant.  I haven't the slightest idea as to why the sprite in the graphics component doesn't show, but the temporary sprite works perfectly fine, even though both sprites' textures point to the same texture.  My guess is that I did something wrong with the draw function inside of the classes, but they look fine to me.  The other thing I think it my be is that the object's sprite isn't keeping the texture for some reason, but I made it set its texture to the <code>rpg::PlayerTexture</code> in its <code>HandleEvents()</code> function so that it would set the texture for sure, but that didn't fix it either.  I am at a complete loss to this and it is probably something simple.</p>
  
  <p>Thanks for taking the time to read through all of this and, if you are able to, I would love an explanation as to why the problem is the problem. Thanks</p>