title: Mouse Over in SDL/C++ not working
body: <p>I have a simple script where by i want the script to load a second button when the mouse is hovering over the first initial button. But it won't return true so i can't seem to get it to work.</p>
  
  <p>This is my class which checks the situation:</p>
  
  <pre><code>class Button
      {
      private:
          int m_x, m_y;            
          int m_width, m_height;
  
      public:
      Button(int x, int y, int width, int height)
      {
         m_x = x;
         m_y = y;
         m_width = width;
         m_height = height;
  
      }
  
      bool IsIn( int mouseX, int mouseY )
      {
          if (((mouseX &gt; m_x) &amp;&amp; (mouseX &lt; m_x + m_width)) 
          &amp;&amp; ((mouseY &gt; m_y) &amp;&amp; (mouseY &lt; m_y + m_height ) ) ) {
              return true;
          } else {
              return false;
          }
      }
  
      void Render(SDL_Surface *source,SDL_Surface *destination)
      {
          SDL_Rect offset;
          offset.x = m_x;
          offset.y = m_y;
          offset.w = m_width;
          offset.h = m_height;
  
          source = IMG_Load("button.png");
  
  
          SDL_BlitSurface( source, NULL, destination, &amp;offset );
  
      }
  };
  </code></pre>
  
  <p>Its the <code>IsIn</code> function I am trying to get to work... in my main loop i have:</p>
  
  <pre><code>while(!quit){
  while( SDL_PollEvent( &amp;event ) )
          switch( event.type ){
              case SDL_QUIT: quit = true; break;
              case SDL_MOUSEMOTION: mouseX = event.motion.x; mouseY = event.motion.y; break;      
          }
  
   Button btn_quit(screen-&gt;w/2,screen-&gt;h/2,0,0);
   btn_quit.Render(menu,screen);
  
   if(btn_quit.IsIn(mouseX,mouseY)){
  
       Button btn_settings(screen-&gt;w/2,screen-&gt;h/2+70,0,0);
       btn_settings.Render(menu,screen);
  
   }
  </code></pre>
  
  <p><code>SDL_Quit</code> works fine but i can't seem to get the if statement after the case statement to return true when i hover the mouse over the <code>btn_quit</code> button. Any ideas why this might be ?</p>