jugant amb clang-tidy
This commit is contained in:
@@ -241,7 +241,7 @@ void Input::printBindings(InputDevice device, int controller_index) const {
|
||||
|
||||
// Muestra los botones asignados
|
||||
for (auto bi : button_inputs_) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "%s : %d", to_string(bi).c_str(), controller_bindings_.at(controller_index).at(static_cast<int>(bi)).button);
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "%s : %d", inputToString(bi).c_str(), controller_bindings_.at(controller_index).at(static_cast<int>(bi)).button);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -258,7 +258,7 @@ int Input::getIndexByName(const std::string &name) const {
|
||||
}
|
||||
|
||||
// Convierte un InputAction a std::string
|
||||
std::string Input::to_string(InputAction input) const {
|
||||
std::string Input::inputToString(InputAction input) const {
|
||||
switch (input) {
|
||||
case InputAction::FIRE_LEFT:
|
||||
return "input_fire_left";
|
||||
@@ -276,7 +276,7 @@ std::string Input::to_string(InputAction input) const {
|
||||
}
|
||||
|
||||
// Convierte un std::string a InputAction
|
||||
InputAction Input::to_inputs_e(const std::string &name) const {
|
||||
InputAction Input::stringToInput(const std::string &name) const {
|
||||
static const std::unordered_map<std::string, InputAction> inputMap = {
|
||||
{"input_fire_left", InputAction::FIRE_LEFT},
|
||||
{"input_fire_center", InputAction::FIRE_CENTER},
|
||||
@@ -295,16 +295,16 @@ bool Input::checkAxisInput(InputAction input, int controller_index, bool repeat)
|
||||
|
||||
switch (input) {
|
||||
case InputAction::LEFT:
|
||||
axis_active_now = SDL_GetGamepadAxis(connected_controllers_[controller_index], SDL_GAMEPAD_AXIS_LEFTX) < -AXIS_THRESHOLD_;
|
||||
axis_active_now = SDL_GetGamepadAxis(connected_controllers_[controller_index], SDL_GAMEPAD_AXIS_LEFTX) < -AXIS_THRESHOLD;
|
||||
break;
|
||||
case InputAction::RIGHT:
|
||||
axis_active_now = SDL_GetGamepadAxis(connected_controllers_[controller_index], SDL_GAMEPAD_AXIS_LEFTX) > AXIS_THRESHOLD_;
|
||||
axis_active_now = SDL_GetGamepadAxis(connected_controllers_[controller_index], SDL_GAMEPAD_AXIS_LEFTX) > AXIS_THRESHOLD;
|
||||
break;
|
||||
case InputAction::UP:
|
||||
axis_active_now = SDL_GetGamepadAxis(connected_controllers_[controller_index], SDL_GAMEPAD_AXIS_LEFTY) < -AXIS_THRESHOLD_;
|
||||
axis_active_now = SDL_GetGamepadAxis(connected_controllers_[controller_index], SDL_GAMEPAD_AXIS_LEFTY) < -AXIS_THRESHOLD;
|
||||
break;
|
||||
case InputAction::DOWN:
|
||||
axis_active_now = SDL_GetGamepadAxis(connected_controllers_[controller_index], SDL_GAMEPAD_AXIS_LEFTY) > AXIS_THRESHOLD_;
|
||||
axis_active_now = SDL_GetGamepadAxis(connected_controllers_[controller_index], SDL_GAMEPAD_AXIS_LEFTY) > AXIS_THRESHOLD;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user