You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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
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 writeinput.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 forconst char*
, and can be automatically casted to from astd::string
, so the cool syntax would workThe text was updated successfully, but these errors were encountered: