So I want to make the mouse looking smooth for my game. I have the mouselook working, but in comparison to games like hl2 or battlefield, its terribly choppy. I'm coding it natively on a mac, and I want to make it cross platform, so help in that regard would be appreciated. This is my current code with the choppiness:
if (giveMouse == false)
{
int speed = 1;
glutWarpPointer(640, 400);
int diffy = y - oldy;
int diff = x - oldx;
oldx = x;
oldy = y;
if (y != 400)
{
pitch += (diffy/4)*speed;
if (pitch < -180)
pitch = -180;
if (pitch > 180)
pitch = 180;
}
if (x != 640)
{
yaw += (diff/8)*speed;
if (yaw > 360)
yaw = 0;
if (yaw < 0)
yaw = 360;
}
Projectile.yaw = yaw;
Projectile.pitch = pitch;
Client.dir = yaw;
}
And thats being called in the glutPassiveMotionFunc. Any help would be appreciated, thanks.