I am adding FPS mouse controls to a 3D demo I am writing in AGK2 Tier 1. Basically, I calculate how much the mouse has moved since the last frame to apply it to the camera's pitch and yaw, and then center the mouse again so it does never reach the corners of the screen (in which case it would stop moving). The code to calculate how much the mouse has moved it this one, and it works perfectly on Windows:
glob.moveMX = GetRawMouseX() - glob.lastMX
glob.moveMY = GetRawMouseY() - glob.lastMY
SetRawMousePosition(GetVirtualWidth() / 2, GetVirtualHeight() / 2)
glob.lastMX = GetRawMouseX()
glob.lastMY = GetRawMouseY()
The problem is that it does not work on the Mac, glob.moveMX and glob.moveMY always report 0. I have noticed that after calling SetRawMousePosition on the Mac, the mouse does not detect movement for a fraction of second. That might be causing the problem.
I don't know if the TGC staff reads this, but I took a look at the libraries for Tier 2 and it looks like AppGameKit uses GLFW on the Mac. By checking the docs, I saw that this could be solved if the SetRawMouseVisible function called this internally when hiding the mouse:
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
Which according to the GLFW docs does this:
Quote: "hides and grabs the cursor, providing virtual and unlimited cursor movement. This is useful for implementing for example 3D camera controls."
It would probably work, but only when the mouse is hidden (which is Ok in my case) by changing the code to something like this:
glob.moveMX = GetRawMouseX() - glob.lastMX
glob.moveMY = GetRawMouseY() - glob.lastMY
if GetDeviceBaseName() <> "mac" then SetRawMousePosition(GetVirtualWidth() / 2, GetVirtualHeight() / 2)
glob.lastMX = GetRawMouseX()
glob.lastMY = GetRawMouseY()
== Jedive ==
MacBook Air Core 2 Duo 1.3Ghz, 4GB, 128GB SSD, HD Graphics 5000, Yosemite
Mac Mini Core 2 Duo 2.2Ghz, 4GB, 640GB HD, nVidia 9400, Yosemite, Win8.1 Pro