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

Input handler internal #86

Merged
merged 3 commits into from
Jun 15, 2024
Merged

Conversation

bhperry
Copy link
Contributor

@bhperry bhperry commented Jun 15, 2024

Moving the InputHandler to backends/internal package. This accomplishes a couple things

  • Clear up the main pixel namespace (handler is never referenced directly by users)
  • With it being a completely internal struct, it is safe to export members directly rather than having handler functions that then get called by window functions. e.g. win.JustPressed(...) can access the PressEvents array directly rather than calling handler.JustPressed(...)

Embedding InputHandler directly in Window rather than using a pointer. Since the handler is never accessed outside of Window, there is no reason for it to be a pointer. This gives a 17-20% increase in access speed according to benchmarks.

Moved the JoystickState struct into the internal package to further differentiate between opengl package specifics and generic backend utilities.

Copy link
Contributor

@dusk125 dusk125 left a comment

Choose a reason for hiding this comment

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

Lgtm

Thanks!

@bhperry bhperry merged commit c3b45d9 into gopxl:main Jun 15, 2024
1 check passed
@bhperry bhperry deleted the bhpery/input-handler-internal branch June 15, 2024 16:41
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.

2 participants