Skip to main content
gamedev.net
🔒 Locked

mouse ?

Started by raton Oct 20, 2003 at 11:01 AM 2 replies 250+ views
Original Post
raton
raton
Hi all. I think everyone will find it easy but how i can make my scene mouve with the mouse... for the leybord there s no problem but i can t find the syntax for the mouse gestion... if you have an url or directly the code.... thanks !
Mess with the bestDie like the rest
Ostsol
Ostsol
Quite OT, but. . .

For a very simplistic implementation you might want to check out GameTutorials.com. Basically you set the mouse cursor to a central location on the screen each frame and then measure how far it gets moved. Based on that you rotate/move the scene. Make sure to factor time into this as well or speed will be dependant on framerate.

There''s also one big problem with this implementation. Since cursor position movement uses integers, you''ll find that at very high framerates movement will become sluggish as faster mouse movements will be required in order to move the cursor a single pixel in the time between frames. Of course, this can be fully prevented by limiting framerate.
-Ostsol
Thunder_Hawk
Thunder_Hawk
quote:
Original post by Ostsol
Of course, this can be fully prevented by limiting framerate.


A much better idea would be to separate the input from the framerate (as it should be) and limit the rate at which the input is processed.

______________________________________________________________
The Phoenix shall arise from the ashes... ThunderHawk -- ¦þ
MySite
______________________________________________________________
______________________________________________________________________________________The Phoenix shall arise from the ashes... ThunderHawk -- ¦þ"So. Any n00bs need some pointers? I have a std::vector<n00b*> right here..." - ZahlmanMySite | Forum FAQ | File Forma
blizzard999
blizzard999
Or simply use a coefficient to divide your mouse ''delta'' position...

your code should be something like

...
GetCursorPos(curpos);
deltapos = curpos - windowcenter;
Process(deltapos.x*cx, deltapos.y*cy);
SetCursorPos(windowcenter);
...

For example deltapos.x changes the longitude of your viewer and deltapos.y the latitude.

Topic Locked

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

Sign in to reply to this topic.