make controllerdb
nom del mando trimmed
This commit is contained in:
@@ -155,11 +155,20 @@ bool Input::checkAnyInput(int device, int index) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Construye el nombre visible de un mando
|
||||
// Construye el nombre visible de un mando.
|
||||
// Recorta des del primer '(' o '[' (per a evitar coses tipus
|
||||
// "Retroid Controller (vendor: 1001) ...") i talla a 25 caràcters.
|
||||
std::string Input::buildControllerName(SDL_Gamepad *pad, int padIndex) {
|
||||
(void)padIndex;
|
||||
const char *padName = SDL_GetGamepadName(pad);
|
||||
std::string name = padName ? padName : "Unknown";
|
||||
const auto pos = name.find_first_of("([");
|
||||
if (pos != std::string::npos) {
|
||||
name.erase(pos);
|
||||
}
|
||||
while (!name.empty() && name.back() == ' ') {
|
||||
name.pop_back();
|
||||
}
|
||||
if (name.size() > 25) {
|
||||
name.resize(25);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user