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

[core] Moves keymapUS[] and fixes GetCharPressed for PLATFORM_DRM #3498

Merged
merged 1 commit into from Nov 1, 2023
Merged

[core] Moves keymapUS[] and fixes GetCharPressed for PLATFORM_DRM #3498

merged 1 commit into from Nov 1, 2023

Conversation

ghost
Copy link

@ghost ghost commented Nov 1, 2023

Changes

  1. Moves the keymapUS[] LUT out of PollKeyboardEvents (L1457-L1476) to Local Variables Definition (R143-R162) so it doesn't have to be redefined every time PollKeyboardEvents() runs on PLATFORM_DRM.

  2. Adds handling for CORE.Input.Keyboard.charPressedQueue and CORE.Input.Keyboard.charPressedQueueCount (R164-R171, R1533-R1543) that was missing on PLATFORM_DRM. That was the reason why couldn't type on examples with type inputs (e.g.: text_draw_3d, text_input_box), since they used GetCharPressed(). Therefore, fixes those examples.

Note

  • The EvkeyToUnicodeLUT (R164-R171) is incomplete, I just mapped the most essential keys so we could get this working. If this doesn't get replaced on the DRM input rework, I'll comeback and finish the LUT.

Reference

Enviroment

  • Tested on Raspberry Pi 3 Model B 1.2 with Linux (Raspberry Pi OS 11 Bullseye 32-bit armhf).

Edits

  • 1: added line marks, formatting.

@raysan5
Copy link
Owner

raysan5 commented Nov 1, 2023

@ubkp thank you very much for the review!

so it doesn't have to be redefined every time PollKeyboardEvents() runs on PLATFORM_DRM.

Please note that, afaik, a static variable defined inside a function is equivalent to a global variable but with reduced scope. It is only initialized once and can be changed on later calls to the function containing it. In any case, having it exposed globally is probably better for organization and future updates.

@raysan5 raysan5 merged commit ba21b8d into raysan5:master Nov 1, 2023
12 checks passed
@ghost
Copy link
Author

ghost commented Nov 1, 2023

Please not that, afaik, a static variable defined inside a function is equivalent to a global variable but with reduced scope. It is only initialized once and can be changed on later calls to the function containing it.

@raysan5 Oh, I didn't know that. Thanks for the explanation. 👍

@ghost ghost deleted the fix/drm-keypress branch November 1, 2023 12:24
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

1 participant