claude: arreglos d'estil
This commit is contained in:
@@ -15,8 +15,10 @@ namespace Options {
|
||||
struct Gamepad;
|
||||
}
|
||||
|
||||
// --- Clase DefineButtons: configuración de botones de gamepad ---
|
||||
class DefineButtons {
|
||||
public:
|
||||
// --- Estructuras ---
|
||||
struct Button {
|
||||
std::string label;
|
||||
Input::Action action;
|
||||
@@ -26,44 +28,44 @@ class DefineButtons {
|
||||
: label(std::move(label)), action(action), button(button) {}
|
||||
};
|
||||
|
||||
// --- Constructor y destructor ---
|
||||
DefineButtons();
|
||||
~DefineButtons() = default;
|
||||
|
||||
// --- Métodos principales ---
|
||||
void render();
|
||||
void update();
|
||||
void handleEvents(const SDL_Event &event);
|
||||
auto enable(Options::Gamepad *options_gamepad) -> bool;
|
||||
void disable();
|
||||
|
||||
// --- Getters ---
|
||||
[[nodiscard]] auto isReadyToClose() const -> bool;
|
||||
[[nodiscard]] auto isEnabled() const -> bool { return enabled_; }
|
||||
[[nodiscard]] auto isFinished() const -> bool { return finished_; }
|
||||
|
||||
private:
|
||||
// Constante para cuánto tiempo mostrar el mensaje (en frames)
|
||||
static constexpr size_t MESSAGE_DISPLAY_FRAMES = 120; // ~2 segundos a 60fps
|
||||
// --- Constantes ---
|
||||
static constexpr size_t MESSAGE_DISPLAY_FRAMES = 120; // Cuánto tiempo mostrar el mensaje (en frames) ~2 segundos a 60fps
|
||||
|
||||
// Punteros
|
||||
// --- Objetos y punteros ---
|
||||
Input *input_ = nullptr; // Entrada del usuario
|
||||
Options::Gamepad *options_gamepad_ = nullptr; // Opciones del gamepad
|
||||
std::unique_ptr<WindowMessage> window_message_; // Mensaje de ventana
|
||||
|
||||
// Vectores y strings
|
||||
// --- Variables de estado ---
|
||||
std::vector<Button> buttons_; // Lista de botones
|
||||
std::vector<std::string> controller_names_; // Nombres de los controladores
|
||||
size_t index_button_ = 0; // Índice del botón seleccionado
|
||||
size_t message_timer_ = 0; // Contador de frames para el mensaje
|
||||
bool enabled_ = false; // Flag para indicar si está activo
|
||||
bool finished_ = false; // Flag para indicar si ha terminado
|
||||
bool closing_ = false; // Flag para indicar que está cerrando
|
||||
bool message_shown_ = false; // Flag para indicar que ya mostró el mensaje
|
||||
bool l2_was_pressed_ = false; // Estado anterior del trigger L2
|
||||
bool r2_was_pressed_ = false; // Estado anterior del trigger R2
|
||||
|
||||
// size_t
|
||||
size_t index_button_ = 0; // Índice del botón seleccionado
|
||||
size_t message_timer_ = 0; // Contador de frames para el mensaje
|
||||
|
||||
// bools
|
||||
bool enabled_ = false; // Flag para indicar si está activo
|
||||
bool finished_ = false; // Flag para indicar si ha terminado
|
||||
bool closing_ = false; // Flag para indicar que está cerrando
|
||||
bool message_shown_ = false; // Flag para indicar que ya mostró el mensaje
|
||||
bool l2_was_pressed_ = false; // Estado anterior del trigger L2
|
||||
bool r2_was_pressed_ = false; // Estado anterior del trigger R2
|
||||
|
||||
// Métodos
|
||||
// --- Métodos internos ---
|
||||
void incIndexButton();
|
||||
void doControllerButtonDown(const SDL_GamepadButtonEvent &event);
|
||||
void doControllerAxisMotion(const SDL_GamepadAxisEvent &event);
|
||||
|
||||
Reference in New Issue
Block a user