# XNA cursor lag

I'm trying to understand if this is avoidable, or it's something I just have to deal with when using XNA.

I made a new game project and loaded simple 16×16 cursor image to draw each frame at exact cursor coordinates, but even with TargetElapsedTime set to 1f/1000f and IsFixedTimeStep = false, it seems as if the game does all calls one host frame late. Game cursor is always visible a few pixels behind the real one.

Can this be fixed somehow, or is there no way around it?

• Just found this post on the net, it kind of reduces the lag, but all resource consumption maxes out, which is not very cool. – user1306322 Feb 23 '13 at 13:47
• could it just be your computer or are you sure its a frame rate issue? – Battle_Pasture Feb 23 '13 at 17:21
• I don't know what kind of issue this truly is, but I know that if unlocked, empty XNA game runs at about 6000 fps. – user1306322 Feb 23 '13 at 17:23
• You could try and predict where the mouse position will be in the next frame by using the position from the previous two frames and then set the current frame to that future prediction. Although this may create noticeable lag when a harsh change in direction or velocity is applied to the mouse. I have never noticed this problem on my computer though, is there any chance that your system is locking up or not powerful enough. I know there will always be a little lag but its not usually noticeable. – Ree Feb 24 '13 at 2:11
• Use hardware cursor, thats how most of games do it. You can change windows cursor to anything you want, via some winapi call (SetCursor) probably. And then use Game.IsMouseVisible = true to show it – Kikaimaru Feb 24 '13 at 8:16