Mouse control problem.

Hello, I wonder how you get control of the mouse in a game…

not in the regular sens like listeners…but like in a shootem up game where the aim always is in the middle of the screen and it never gets to the end of the frame so you can go around hoe much you want.

For me when I navigate at the moment I can only rotate untill the cursor comes to the end of the frame.

how do I solve this?

thx!

I think the way Jake2 handles this is using java.awt.Robot to repeatedly move the mouse back to the center of the window. This thread indicates there may be some issues with using this technique under OS X. Ultimately I think the right way to do this is to have JInput support “grabbing” of the mouse cursor. Try using Robot and see how far it gets you (and please post if you run into problems with this technique).

How do I “grab” the cursor with JInput?

any examples?

I use the java.awt.Robot way in Wurm, and I’ve never had any complaints about it.
But there definitely are issues… if the mouse goes outside the game window, the os will show it (yes, even on windows)… that includes if a popup appears on top of your game window. So if the user gets an instant message while playing, he can get stuck in a very annoying behavior with a mouse pointer that keeps moving back to the center of the popup when he tries to move it away to drag the game window.