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.
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.
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;
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. Note in the picture how they are in two different places.