title: Strange SFML behavior
body: <p>I'm currently trying to write a button class. It takes 2 textures, <code>m_texture</code> and <code>m_onHover</code>, and its caption, which should be automatically centered. The function <code>update()</code> takes care of selecting the correct texture.</p>
  
  <pre><code>class button : public sf::Drawable
  {
  private:
      const sf::Texture *m_texture;
      const sf::Texture *m_onHover;
      sf::Sprite m_sprite;
  
  public:
      button(); 
  
      sf::Text m_caption; // public to allow easy formating, see centerCaption()
  
      bool mouseIsOver() const;
      void update();
  
      void setPosition(sf::Vector2f position);
      void setPosition(float x, float y);
  
      void centerCaption();
  
      // Access functions
      void setTexture(const sf::Texture &amp;texture) { m_texture = &amp;texture;     m_sprite.setTexture(*m_texture); }
      void setonHoverTexture(const sf::Texture &amp;texture) { m_onHover = &amp;texture; }
      void setCaption(sf::String text)    { m_caption.setString(text);        centerCaption(); }
      void setFontSize(unsigned int size) { m_caption.setCharacterSize(size); centerCaption(); }
      void setFont(sf::Font&amp; font) { m_caption.setFont(font); }
  
  private:
      virtual void draw(sf::RenderTarget&amp; target, sf::RenderStates states) const;
  };
  
  bool button::mouseIsOver() const
  {
      if (m_sprite.getGlobalBounds().contains(sf::Vector2f(sf::Mouse::getPosition())))    // creating a float vector for contains() because getPosition gives int vector
      {
          return true;
      }
      else
      {
          return false;
      }
  }
  </code></pre>
  
  <p>Everything seems to be working, but the mouse position at which <code>mouseIsOver()</code> returns true seems to be moved 40 pixels above the sprite. The values in the rect from <code>getGlobalBounds()</code> seem to be correct when printed in the console.</p>
  
  <p>Unluckily I dont have enough reputation to post a screenshot.</p>