title: event check only when clicked on a button
body: <p>I have a simple test script, which it meant to change a boolean when the user clicks within the dimensions of the button but it is not working.</p>
  
  <p>I approached it like so:</p>
  
  <pre><code>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;    
              case SDL_MOUSEBUTTONDOWN: click = true; 
          }
  }
   Button btn_settings(btn_x,btn_y);
   if(btn_settings.IsIn(mouseX,mouseY)){
      btn_settings.RenderImg(menu,screen,"button_on.png","Settings");
  
      if(click){
          quit = true;
      }
  
   } else {
      btn_settings.RenderImg(menu,screen,"button.png","Settings");
   }
  </code></pre>
  
  <p>The problem is if i click any where then click equals true, then if the mouse is <code>over</code> the quit button it exits even if the button wasn't pressed when over the button.</p>
  
  <p>I'm confused how i can make it work properly.</p>