I'm trying to do an FPS camera where the amount the mouse moved is stored each frame and then the pointer gets reset to the center. This needs to be done for each frame or at least every few milliseconds but with SetRawMousePosition the pointer is 'stuck' to the center, and won't allow movement of the mouse when called every frame. But this is strange because there is at least a few milliseconds before this function is called where the mouse might have moved. I've tried calling SetRawMousePosition every few milliseconds but still the pointer is 'stuck' with no difference in mouse X, Y values. If I wait at least 500 milliseconds then finally the pointer moves and I can get values but this results in the mouse look stuttering.
I.e. heres what im trying to do, trying to write similar code in AGK2 Basic:
//called every frame
void mouse_motion(int x, int y) {
static bool wrap = false;
if(!wrap) {
int ww = glutGet(GLUT_WINDOW_WIDTH);
int wh = glutGet(GLUT_WINDOW_HEIGHT);
//get amount mouse moved this frame
int dx = x - ww / 2;
int dy = y - wh / 2;
// Do something with dx and dy here
// move mouse pointer back to the center of the window
wrap = true;
glutWarpPointer(ww / 2, wh / 2);
} else {
wrap = false;
}
}
I've tried everything. How can one implement smooth mouse look in AGK2?