title: XNA Hold and Click on same object
body: <p>If the same object in a game have two different actions for clicking on it and holding the mouse clicked over it, using the default input (the current and the last MouseState), you will activate the click action even with you are holding. For example, you use the hold to drag n' drop an object over the screen, but when you click it, it should vanish. On the moment you just click on the object to move it, it'll vanish, which is an unwanted result.</p>
  
  <pre><code>MouseState current, last;
  
  public void Update(GameTime gameTime) {
     current = Mouse.GetState();
  
     bool clicked = current.LeftButton == ButtonState.Pressed &amp;&amp; last.LeftButton == ButtonState.Released;
     bool holding = current.LeftButton == ButtonState.Pressed;
  
     if(clicked) vanishObject();
     if(holding) moveObject(current.X, current.Y);
  
     last = current;
  }
  </code></pre>
  
  <p>I thought to solve it using a flag to "held more than N seconds" and put the vanish on ReleasedClick, checking  the flag, but changing the event time doesn't seem to be an elegant solution. Any ideas?</p>