Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

iOS and MacOS / Mouse look on macOS

Author
Message
Jedive
21
Years of Service
User Offline
Joined: 24th Jan 2003
Location: Spain
Posted: 17th Oct 2017 16:45 Edited at: 18th Oct 2017 00:37
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:



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:

== 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

Login to post a reply

Server time is: 2024-03-28 20:31:27
Your offset time is: 2024-03-28 20:31:27