Input of mouseclick not always registered in XNA Update method
- by LordrAider
I have a problem that not all inputs of my mouse events seem to be registered.
The update logic is checking a 2 dimensional array of 10x10 .
It's logic for a jewel matching game.
So when i switch my jewel I can't click on another jewel for like half a second.
I tested it with a click counter variable and it doesn't hit the debugger when i click the second time after the jewel switch. Only if I do the second click after waiting half a second longer.
Could it be that the update logic is too heavy that while he is executing update logic my click is happening and he doesn't register it?
What am I not seeing here :)? Or doing wrong. It is my first game.
My function of the update methode looks like this.
public void UpdateBoard()
{
MouseState currentMouseState;
currentMouseState = Mouse.GetState();
if (currentMouseState.LeftButton == ButtonState.Pressed &&
prevMouseState.LeftButton != ButtonState.Pressed)
{
UpdatingLogic = true;
// this.CheckDropJewels(currentMouseState);
//this.CheckMatches(3);
//this.RemoveMatches();
this.CheckForSwitch(currentMouseState);
this.MarkJewel(currentMouseState);
UpdatingLogic = false;
//reIndexMissingJewels = true;
reIndexSwitchedJewels = true;
}
prevMouseState = currentMouseState;
this.ReIndex();
this.UpdateJewels();
}