Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hiding mouse cursor with glfw

Tags:

I'm working with a game made with glfW and running in Ubuntu. My problem is that hiding the mouse cursor with the line

glfwDisable(GLFW_MOUSE_CURSOR); 

causes some machines to simply disregard the mouse input, and thus breaks the game.

Has anyone faced this problem? If so, what was your workaround?

like image 954
JMCampos Avatar asked Dec 13 '10 17:12

JMCampos


People also ask

How do I hide my cursor on Glfw?

It sounds like you may want to use GLFW_CURSOR_DISABLED (GLFW 3+). glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); GLFW_CURSOR_DISABLED hides and locks the cursor so it can't leave your window, just like glfwDisable(GLFW_MOUSE_CURSOR); .

How do I hide my mouse pointer while playing the mouse?

The “Pointer Options” tab displays various mouse settings. Here, in the “Visibility” section, enable the “Hide Pointer While Typing” option. Then click “Apply” and “OK.” And you're all set.


1 Answers

Since glfw 3.0 the API call has changed, you must use glfwSetInputMode with a pointer of your window.

glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN); 

For more information see http://www.glfw.org/docs/3.0/moving.html

like image 70
Alexandre Jacob Avatar answered Sep 30 '22 03:09

Alexandre Jacob