Original Post
🔒 Locked
mouse ?
Advertisement
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.
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.
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
______________________________________________________________
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.
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.
Advertisement