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 Input. #928

Merged
merged 37 commits into from
Jun 24, 2019
Merged

GLFW Input. #928

merged 37 commits into from
Jun 24, 2019

Conversation

PJB3005
Copy link
Member

@PJB3005 PJB3005 commented Jun 11, 2019

Purpose of this PR

Implements input on GLFW. Keyboard input and mouse input works. Gamepad/joystick is not.

I had to fix GLFW window instancing too to actually test this, so if these changes are out of scope I can move them to a separate PR.

There's still a lot to do here but this is already a pretty big PR I would say.

Testing status

I have tested this with the wonderful world of Console.WriteLine and manual main loops.

@PJB3005 PJB3005 changed the title [WIP] GLFW Input. GLFW Input. Jun 11, 2019
@PJB3005 PJB3005 marked this pull request as ready for review June 12, 2019 20:30
@varon
Copy link
Member

varon commented Jun 13, 2019

Just deferring this until I've checked over the others as it's quite large!

Copy link
Member

@varon varon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good so far. Only significant change is removing our key enum and just using GLFW directly.

Opinions?

@varon
Copy link
Member

varon commented Jun 13, 2019

Going back and forth on how best to avoid the mismatch issue between GLFW keys and OpenTK.Input.Keys:

Current plan is to update our Key/Mouse/whatever enums to match the GLFW values directly. We use those inside GLFW directly (instead of having a second GLFW key enum and trying to map between them).

This way we get all of the benefits of 1:1 mapping without the hard dependency on GLFW on other platforms.

@varon
Copy link
Member

varon commented Jun 21, 2019

@Vassalware / @jvbsl - Would really appreciate a review on this if you guys can!

Copy link
Contributor

@jvbsl jvbsl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for KeyboardState I found nothing major and looks good so far. I did not test it though

/// <summary>
/// Gets the string representation of the input Unicode code point.
/// </summary>
public string String => char.ConvertFromUtf32(Unicode);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think UnicodeString or something like that would be better. Just naming it String seems wrong to me because System.String is a type

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm open to a better name (AsString maybe?), but UnicodeString or something is kind of redundant since strings are always Unicode.

Copy link
Member

@varon varon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @PJB3005. This is super thorough and well written.

Only required change is the unsafe on the public API. The rest are all nice-to-haves.

@varon varon merged commit 1fb906a into opentk:master Jun 24, 2019
@varon
Copy link
Member

varon commented Jun 24, 2019

Kickass work and thanks again, @PJB3005 .

@varon
Copy link
Member

varon commented Jun 24, 2019

Thanks to @jvbsl for the help on the review as well!

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

Successfully merging this pull request may close these issues.

None yet

3 participants