public void Update(int pressedButton) { #region Aim camera Pointer position = new Pointer(); Winapi.GetCursorPos(ref position); int difX = MainForm.FormPos.X + 512 - position.x; int difY = MainForm.FormPos.Y + 384 - position.y; if (position.y < 384) { pitch -= rotationSpeed * difY; } else if (position.y > 384) { pitch += rotationSpeed * -difY; } if (position.x < 512) { yaw += rotationSpeed * -difX; } else if (position.x > 512) { yaw -= rotationSpeed * difX; } UpdateDirVector(); CenterMouse(); if (pressedButton == 1) // se apreto el boton izquierdo de mouse { eyex -= (float)i * forwardSpeed; eyey -= (float)j * forwardSpeed; eyez -= (float)k * forwardSpeed; } else if (pressedButton == -1) // se apreto el boton derecho del mouse { eyex += (float)i * forwardSpeed; eyey += (float)j * forwardSpeed; eyez += (float)k * forwardSpeed; } #endregion Look(); }
public static extern void GetCursorPos(ref Pointer point);