Skip to main content
gamedev.net
🔒 Locked

[java] Mouse control

Started by dmiranda 1 reply 500+ views
Original Post
dmiranda
dmiranda
Hello, I'm playing around with developing first-person perspective game. The player's view (look left/right/up/down) will be mouse driven. The only problem is that when the mouse pointer reaches the edge of the monitor, the mouse stops, and the rotation stops. It would be nice to be able to control the mouse pointer so that once the mouse hits the edge of the monitor, the mouse pointer can be programatically moved to the center of the screen, so that the user can continually mouse in one direction without interruption. I'm not sure if it is possible to do this in Java...and I'm a little worried that I'll have to use jni calls to native libraries that handle this. Anyways, my questions are: 1) Is it possible to control the pointer using standard Java libraries? 2) Is there a better way to produce this effect besides controlling the mouse? Thanks
harveypekar
harveypekar
Use the java.awt class Robot. It has a method mouseMove(int x, int y).

Cheers
dmiranda
dmiranda
Thats wonderful :)

Thank you!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.