I'm making a menu in XNA; and to solve clunky input via arrow keys, I thought I would use mouse input. I got everything to work perfectly, then I tried to click on something specific and nothing happened. To troubleshoot, I drew an image where the cursor rectangle is supposed to be. As you can see in the image below it's nowhere near my mouse.
Another image of the cursors lag
Note how they are in two different places.
How do I fix this horrible lag?
The menu update calls a mouse class to update the mouse position and place it within bounds of the screen. The mouse class also has a rectangle that updates based on the mouse position, but it updates almost 200 pixels away. The mouse moves fine in game, it's just the rectangle is in a weird position
//This is located in the Mouse Class
public void Update(GameTime gameTime)
{
oldmouse = currentmouse;
currentmouse = Mouse.GetState();
Position.X = currentmouse.X;
Position.Y = currentmouse.Y;
//Some other boundary code that's not essential
clickRectangle.X = (int)Position.X;
clickRectangle.Y = (int)Position.Y;
}
// this is located in the menu class
public void Draw(SpriteBatch spriteBatch)
{
spriteBatch.Draw(ArrowTexture, mouseInput.clickRectangle, Color.White);
//draw other arrows and text
}
I don't see a problem with the code. Is there something else I have to do?
I should also mention it sometimes draw nearer to the actual cursor and sometimes farther away. The cursor only drew to my actual cursor once before it stopped working.
EDIT: I updated the question with more relevant information. I apologize for not including it earlier.