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

Change Input::pressed, ::axis, etc to use std::string_view #1437

Open
RiscadoA opened this issue Jan 27, 2025 · 0 comments · May be fixed by #1460
Open

Change Input::pressed, ::axis, etc to use std::string_view #1437

RiscadoA opened this issue Jan 27, 2025 · 0 comments · May be fixed by #1460
Assignees
Labels
A-Engine B-Input D-Trivial Can be done in 30 minutes P-Normal This issue isn't a big priority, but it would still be nice to have it closed soon
Milestone

Comments

@RiscadoA
Copy link
Member

Problem

Currently these methods all receive a const char* for the action/axes names etc.
This isn't practical when the name strings are stored as std::string in fields - the user must write input.pressed(action.c_str()).
It would be more readable/easier to just write input.pressed(action).

Solution

We should simply use std::string_view - basically a wrapper for const char*, and can be automatically casted to from a std::string, so the cool syntax would work

@RiscadoA RiscadoA added A-Engine B-Input D-Trivial Can be done in 30 minutes P-Normal This issue isn't a big priority, but it would still be nice to have it closed soon labels Jan 27, 2025
@RiscadoA RiscadoA added this to the 0.7 milestone Jan 27, 2025
@RiscadoA RiscadoA changed the title Cahnge Input::pressed, ::axis, etc to use std::string_view Change Input::pressed, ::axis, etc to use std::string_view Jan 27, 2025
@RiscadoA RiscadoA removed this from the 0.7 milestone Jan 27, 2025
@kuukitenshi kuukitenshi self-assigned this Feb 10, 2025
@kuukitenshi kuukitenshi added this to the 0.7 milestone Feb 10, 2025
@kuukitenshi kuukitenshi linked a pull request Feb 10, 2025 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Engine B-Input D-Trivial Can be done in 30 minutes P-Normal This issue isn't a big priority, but it would still be nice to have it closed soon
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants