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

Add new sokol_poll.h layer #788

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Toctave
Copy link

@Toctave Toctave commented Feb 11, 2023

Basic polling layer on top of sokol_app's event API. Only supports keyboard input for now.

@floooh
Copy link
Owner

floooh commented Feb 12, 2023

It's a good PR for discussion, but I'll probably won't merge it, sorry :)

I have a couple more things in mind apart from just managing a key-pressed bitfield:

  • have an "any" and "all" function which take bitmasks to check if any of a key group or all of a key group is currently pressed
  • then there's the whole problem area of missing presses when the down- and up-event happen in the same frame, so "is key X currently pressed" becomes a "was key X pressed at any time during the last frame" => which in turn means that the library needs to know when a new frame starts... for a solution there should probably a separate bitmask for key-down events and key-up events in a frame, which are then 'consolidated' into a key-pressed bitmask.
  • and the 'key mask' should probably be a 'button mask' which at least includes mouse buttons
  • and it should also be possible to poll the current mouse position
  • ...and while at it, it would be nice to tackle gamepad support, but not sure if this should go into a separate header - but the input polling header should at least somehow integrate the gamepad input.

...etc... etc...

@Toctave
Copy link
Author

Toctave commented Feb 12, 2023

Yeah I thought of this as a starting point / discussion PR, ofc it won't be merged until it fits what you had in mind.

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

2 participants