Get mouse speed instead of position?

Uuugggg
Unregistered
 
Post: #1
Let me first try to ask this as simply as possible... how would you program a simple first-person perspective game using the mouse to look around?
I've got the graphics and the orientation all done using the keyboard as input, I just want to get the mouse to look around like in every FPS out there. Using GLUT... is this possible?


I've tried keeping the cursor at the middle, then after a motion call finding the difference and using that as the speed ( glutWarpPointer to reset cursor to the center each frame) - and for all I know that should work... but it's being a bit stubborn about actually moving all the time.
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #2
You can maybe use
Code:
void CGGetLastMouseDelta( CGMouseDelta * deltaX, CGMouseDelta * deltaY );
from CGDirectDisplay.h (CoreGraphics inside ApplicationServices)

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Luminary
Posts: 5,125
Joined: 2002.04
Post: #3
glutWarpPointer introduces an 0.25 second delay where no mouse movements are reported, on Mac OS X. If you want to use glutWarpPointer (which is fine) then you need to call CGSetLocalEventsSuppressionInterval(0.0) first to make it work "normally".
Quote this message in a reply
Uuugggg
Unregistered
 
Post: #4
CGGetLastMouseDelta - exactly. Everything's working great.

So, not possible with GLUT... happy to need to use CoreGraphics! OH so many header files to look through!
Quote this message in a reply
Post Reply