Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am using this code in Update method in XNA RenderControl in Windows Forms:

...
Mouse.WindowHandle = renderControl1.Handle;
MouseState stat=Mouse.GetState();
...

Everything works fine but when I want to record it with Fraps I get this result: http://www.youtube.com/watch?v=oDmzAIx_wU0 mouse position is moved but in screen everything is OK. When first line is removed I have moved cursor on screen but not in video. Is posible to have same result in both cases?

share|improve this question
    
Can you take a look at my classes? How did you get the mouse to work? My keyboard works, but mouse input isn't updating: gamedev.stackexchange.com/questions/61006/… –  ChocoMan Aug 19 '13 at 19:01
add comment

1 Answer

up vote 4 down vote accepted

I'm not sure if it will work in your specific problem but I also use Windows Forms with XNA and after trying many ways to get consistent mouse behavior across several different situations, I settled with this:

public Vector2 GetMousePosition()
{
    System.Drawing.Point point = this.PointToClient(Control.MousePosition);
    return new Vector2(point.X, point.Y);
}

This method returns the current mouse position relative to the control bounds. Put that inside your control class and see how it works for you. This solved a few problems I was having when I tried using the XNA Mouse API for reading the mouse position, in particular when placing my XNA rendering control inside of another control.

Your problem seems to be a different one, but I've just tried using Fraps on my application which uses the method described above, and it's working correctly, so I think it should probably solve your problem too.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.