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

glfwGetKey() always return 0, the version is 3.2.1 #1230

Closed
Tbwas opened this issue Mar 9, 2018 · 4 comments
Closed

glfwGetKey() always return 0, the version is 3.2.1 #1230

Tbwas opened this issue Mar 9, 2018 · 4 comments
Labels
Milestone

Comments

@Tbwas
Copy link

Tbwas commented Mar 9, 2018

No description provided.

@tombsar
Copy link
Contributor

tombsar commented Mar 9, 2018

Can you give us any more information about the problem? e.g. your OS, and what code you are trying to run.

It would also be helpful if you could try running against the latest master (effectively pre-release 3.3) to see if the issue has been fixed already.

@Tbwas
Copy link
Author

Tbwas commented Mar 9, 2018

OK. The macOS version is 10.12.6, I want to close window when release the escape key. However, the glfwGetKey(window, GL_KEY_ESCAPE) is always return 0 even if I release other keys. The code is
image

@ghuser404
Copy link

glfwGetKey returns current state of the given key, at the moment of the call.

Basically, what you are doing is on any key press/release you are asking GLFW if ESC is not pressed currently.

You should be using the key/scanCode arguments to determine what key got pressed/released.

@Tbwas
Copy link
Author

Tbwas commented Mar 11, 2018

@ghuser404 oh~ i got it, thanks very much.

@Tbwas Tbwas closed this as completed Mar 11, 2018
@elmindreda elmindreda added this to the None milestone Mar 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants