quote:Original post by Bad Monkey
This is sort of related... does anyone know if you can get relative mouse coords from GLUT, or set the mouse coords? (I can''t find a way, and I''ve been looking for ages)
Just curious.
Note - I have no idea what actual GLUT function calls are, so this is just pseudocode.
// Vars to store the last frame''s mouse position
static int last_X = GetAbsMousePosX();
static int last_Y = GetAbsMousePosY();
// Get the current frame''s mouse position
int curr_X = GetAbsMousePosX();
int curr_Y = GetAbsMousePosY();
// Calculate the relative motion
int rel_X = curr_X - last_X;
int rel_Y = curr_Y - last_Y;
// Store this frame''s mouse position for next time
last_X = curr_X;
last_Y = curr_Y;
Hope that helps.