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

glfw: fix key.press being set to release #27

Merged
merged 1 commit into from
Sep 17, 2021
Merged

Conversation

Avokadoen
Copy link
Contributor

  • By selecting this checkbox, I agree to license my contributions to this project under the license(s) described in the LICENSE file, and I have the right to do so or have received permission to do so by an employer or client I am producing work for whom has this right.

A very minor fix to correct key.press being set to GLFW_RELEASE instead of GLFW_PRESS

@Avokadoen
Copy link
Contributor Author

Avokadoen commented Sep 16, 2021

Also if it is desired, I could look into replacing the int values defined in key and action into enum(c_int) and mod into a bitmask with packed struct. This would "ziggify" the API a bit, but might be undesirable if the change is too big of a deviation from raw glfw. The issue with key.press was detected because I am wrapping everything in the mentioned manner on my end. 👍

See: here for implementation

@slimsag
Copy link
Member

slimsag commented Sep 17, 2021

Thanks for this @Avokadoen !

Do I understand correctly that the reason you prefer an enum(c_int) is because it's then a proper type, so you can pass it around as such in functions etc.? That makes sense to me, feel free to send that change!

The packed struct approach for mod also sounds good to me 👍

In general, I am not too worried about Zigifying / deviating a bit from the GLFW C API. I think that this is good, and prevents the need for "higher level" GLFW wrappers which is a good thing. Same reason I've opted for returning proper Zig errors instead of using a callback (although, GLFW error handling is a bit tricky, you really should ignore/log most errors.. so this may have been a bad call..) Of course, we should be mindful not to deviate too far as that would make updating to newer GLFW versions more tedious.

Thanks again!

@slimsag slimsag merged commit c61bd48 into hexops:main Sep 17, 2021
@Avokadoen
Copy link
Contributor Author

Cheers! I'll get on it after the weekend 👍

@slimsag slimsag changed the title fix key.press being set to release glfw: fix key.press being set to release Aug 6, 2022
@slimsag slimsag added the glfw label Aug 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants