Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

capture cursor (GLFW window, possibly more) #4940

Open
travisfoo opened this issue Feb 23, 2016 · 1 comment
Open

capture cursor (GLFW window, possibly more) #4940

travisfoo opened this issue Feb 23, 2016 · 1 comment

Comments

@travisfoo
Copy link

Hey there, I'm working on a first person game in 3D. While making my camera, I realized there was no functionality for capturing the cursor in open frameworks.

The code is rather simple for GLFW, which I'm using. Not sure how hard it would be to integrate into GLUT or the other windowing systems.

Here's the code I added to to my open frameworks:

void ofAppGLFWWindow::captureCursor(){
    glfwSetInputMode(windowP,GLFW_CURSOR,GLFW_CURSOR_DISABLED);
};

Worked well with the input stuff so far, like mouse position and mouse click etc.

@DanBennettDev
Copy link

DanBennettDev commented Mar 28, 2019

For anyone who stumbles across this, it is exactly equivalent to calling

ofToggleFullscreen();
ofHideCursor();

which results in

glfwSetInputMode(windowP,GLFW_CURSOR,GLFW_CURSOR_DISABLED);

being called

However, there seems to be a potential problem with accuracy of mouse movement when this mode is enabled -
#6268

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants