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

Implement ToString for KeyCode #1995

Closed
billyb2 opened this issue Apr 23, 2021 · 2 comments
Closed

Implement ToString for KeyCode #1995

billyb2 opened this issue Apr 23, 2021 · 2 comments
Labels
A-Input Player input via keyboard, mouse, gamepad, and more A-UI Graphical user interfaces, styles, layouts, and widgets C-Feature A new feature, making something new possible

Comments

@billyb2
Copy link
Contributor

billyb2 commented Apr 23, 2021

What problem does this solve or what need does it fill?

By implementing ToString for each KeyCode, it would make it possible to easily display the keybindings for a game.

What solution would you like?

A pretty long impl std::fmt::Display for KeyCode with every KeyCode either having their literal character printed out, or a description (like Backspace)

What alternative(s) have you considered?

Possibly just implementing std::fmt::Display, though I feel as though ToString wouldn't be very difficult once that is implemented

Other solutions to solve and/or work around the problem presented.

Limiting the possible charaters used, and then having a display for each of those characters, though that feels like implementing ToString and Display with extra steps.

Additional context

Any other information you would like to add such as related previous work,
screenshots, benchmarks, etc.

@billyb2 billyb2 added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Apr 23, 2021
@alice-i-cecile alice-i-cecile added A-Input Player input via keyboard, mouse, gamepad, and more A-UI Graphical user interfaces, styles, layouts, and widgets and removed S-Needs-Triage This issue needs to be labelled labels Apr 23, 2021
@alice-i-cecile
Copy link
Member

As I understand it a clean mapping from KeyCode's to string / characters / glyphs doesn't exist :(

See #782, #804, #805, #1392 for some previous discussion on these lines. #805 was implemented; does it provide what you need?

@billyb2
Copy link
Contributor Author

billyb2 commented Apr 23, 2021

Yea that works perfectly, I'll close this, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Input Player input via keyboard, mouse, gamepad, and more A-UI Graphical user interfaces, styles, layouts, and widgets C-Feature A new feature, making something new possible
Projects
None yet
Development

No branches or pull requests

2 participants