Pasaeta de linters

This commit is contained in:
2025-08-06 13:05:04 +02:00
parent 8ed2dbcd4f
commit 1224af2a9b
40 changed files with 623 additions and 592 deletions

View File

@@ -1,38 +1,38 @@
#include "define_buttons.h"
#include <algorithm> // Para max, __all_of_fn, all_of
#include <algorithm> // Para __all_of_fn, all_of
#include <functional> // Para identity
#include <memory> // Para allocator, shared_ptr, __shared_ptr_access, operator==
#include "input.h" // Para Input, InputAction
#include "lang.h" // Para getText
#include "options.h" // Para GamepadOptions, controllers
#include "param.h" // Para Param, param, ParamGame, ParamTitle
#include "resource.h" // Para Resource
#include "text.h" // Para Text
#include "input.h" // Para Input
#include "input_types.h" // Para InputAction
#include "lang.h" // Para getText
#include "options.h" // Para Gamepad
#include "param.h" // Para Param, param, ParamGame, ParamTitle
#include "resource.h" // Para Resource
#include "text.h" // Para Text
// Constructor
DefineButtons::DefineButtons()
: input_(Input::get()),
enabled_(false),
finished_(false),
x_(param.game.width / 2),
y_(param.title.press_start_position),
index_button_(0) {
y_(param.title.press_start_position) {
clearButtons();
auto gamepads = input_->getGamepads();
for (auto gamepad : gamepads) {
controller_names_.emplace_back(input_->getControllerName(gamepad));
controller_names_.emplace_back(Input::getControllerName(gamepad));
}
}
// Dibuja el objeto en pantalla
void DefineButtons::render() {
static auto text = Resource::get()->getText("8bithud");
static auto text_ = Resource::get()->getText("8bithud");
if (enabled_) {
text->writeCentered(x_, y_ - 10, Lang::getText("[DEFINE_BUTTONS] PLAYER") + std::to_string(static_cast<int>(options_gamepad_->player_id)));
text->writeCentered(x_, y_, options_gamepad_->name);
text->writeCentered(x_, y_ + 10, buttons_.at(index_button_).label);
text_->writeCentered(x_, y_ - 10, Lang::getText("[DEFINE_BUTTONS] PLAYER") + std::to_string(static_cast<int>(options_gamepad_->player_id)));
text_->writeCentered(x_, y_, options_gamepad_->name);
text_->writeCentered(x_, y_ + 10, buttons_.at(index_button_).label);
}
}
@@ -55,12 +55,12 @@ void DefineButtons::doControllerButtonDown(const SDL_GamepadButtonEvent &event)
// Asigna los botones definidos al input_
void DefineButtons::bindButtons(Options::Gamepad *options_gamepad) {
for (const auto &button : buttons_) {
input_->bindGameControllerButton(options_gamepad->instance, button.action, button.button);
Input::bindGameControllerButton(options_gamepad->instance, button.action, button.button);
}
// Remapea los inputs a inputs
input_->bindGameControllerButton(options_gamepad->instance, Input::Action::SM_SELECT, Input::Action::FIRE_LEFT);
input_->bindGameControllerButton(options_gamepad->instance, Input::Action::SM_BACK, Input::Action::FIRE_CENTER);
Input::bindGameControllerButton(options_gamepad->instance, Input::Action::SM_SELECT, Input::Action::FIRE_LEFT);
Input::bindGameControllerButton(options_gamepad->instance, Input::Action::SM_BACK, Input::Action::FIRE_CENTER);
}
// Comprueba los eventos
@@ -121,9 +121,9 @@ void DefineButtons::clearButtons() {
// Comprueba si ha finalizado
void DefineButtons::checkEnd() {
if (finished_) {
bindButtons(options_gamepad_); // Asigna los botones definidos al input_
input_->saveGamepadConfigFromGamepad(options_gamepad_->instance); // Guarda los cambios
input_->resetInputStates(); // Reinicia los estados de las pulsaciones de los botones
enabled_ = false; // Deshabilita
bindButtons(options_gamepad_); // Asigna los botones definidos al input_
input_->saveGamepadConfigFromGamepad(options_gamepad_->instance); // Guarda los cambios
input_->resetInputStates(); // Reinicia los estados de las pulsaciones de los botones
enabled_ = false; // Deshabilita
}
}