Moving the mouse

Started by
3 comments, last by Big_Al482 22 years, 9 months ago
I made a fullscreen app in opengl where the mouse controls the camera''s orientation. The problem is, the camera''s rotation is limited to where the mouse moves on the screen, so when the mouse gets to the edge, the user can''t look in that direction anymore. Does anyone know how to move the mouse on the screen so that when it gets to one side you can reposition it back to the center or something? Thanks
Advertisement
I am assuming that you are getting mouse input from the windows messages (that''s what it sounds like at least).

Probably one of the best ways to get the mouse input is through DirectInput. It isn''t a hard interface to learn at all and as mouse input, it will give you info describing how far the mouse has moved relative to the last time you checked, rather than it''s specific screen coordinate. I think this would help you a lot.

If you want me to give you some easy code to intialize and use DirectInput to get mouse data, reply or e-mail me.
What you need to do is this. Set it up so that on every render, the mouse position is set back to 320,240 (if your in 640x480) so that the mouse is at the center of the screen on eace frame. Then it can''t go off the edge.

"With my feet upon the ground I lose myself between the sounds and open wide to suck it in, I feel it move across my skin. I'm reaching up and reaching out. I'm reaching for the random or what ever will bewilder me, what ever will bewilder me. And following our will and wind we may just go where no one's been. We'll ride the spiral to the end and may just go where no one's been." - Maynard James Keenan Name: [email=darkswordtbj@hotmail.com]TheBlackJester[/email]Team: Wildfire Games
Projects O A.D.The Last Alliance

do you know the 3dmax interface?

once you drag the mouse, lets say bottomwise, and it reaches to
the bottom edge, then the interface "jumps" the mouse to the top
of the screen, so you can keep dragging the mouse bottomwise
and the mouse will keep "falling".
if you worry about the user watching the mouse do that, and
you want the mouse to look as if it stands in the middle of
the screen, just hide the mouse, and draw a pseudo one standing
stilt at the center of the screen while the user do the drag.
one he gets out of the drag mode, mouse return to himself

Gil
[email=gil@gilzu.com]Gil Zussman[/email]Check out Goose Chase, Coming this fall!http://www.gilzu.com
try using directinput and setting the input mode to be axis based .. i think its the default.

then you wont have an end to the mouse scope ..

if you move to the right , the X will be positive.
if you move to the left , the X will be negative.

that should solve your problem .



{ Stating the obvious never helped any situation !! }

This topic is closed to new replies.

Advertisement