This commit is contained in:
2024-10-23 22:18:46 +02:00
parent 6e2f80d8ce
commit 8c98430b68
2 changed files with 20 additions and 43 deletions

View File

@@ -1,10 +1,10 @@
#pragma once
#include <SDL2/SDL_events.h> // for SDL_ControllerButtonEvent
#include <SDL2/SDL_gamecontroller.h> // for SDL_GameControllerButton
#include <memory> // for shared_ptr, unique_ptr
#include <string> // for string
#include <vector> // for vector
#include <SDL2/SDL_events.h> // for SDL_ControllerButtonEvent
#include <SDL2/SDL_gamecontroller.h> // for SDL_GameControllerButton
#include <memory> // for shared_ptr, unique_ptr
#include <string> // for string
#include <vector> // for vector
class Input;
class Text;
enum class InputType : int;
@@ -14,6 +14,10 @@ struct DefineButtonsButton
std::string label; // Texto en pantalla para el botón
InputType input; // Input asociado
SDL_GameControllerButton button; // Botón del mando correspondiente
// Constructor
DefineButtonsButton(const std::string &lbl, InputType inp, SDL_GameControllerButton btn)
: label(lbl), input(inp), button(btn) {}
};
// Clase Bullet
@@ -25,12 +29,12 @@ private:
std::shared_ptr<Text> text_; // Objeto para escribir texto
// Variables
bool enabled_; // Indica si el objeto está habilitado
bool enabled_ = false; // Indica si el objeto está habilitado
int x_; // Posición donde dibujar el texto
int y_; // Posición donde dibujar el texto
std::vector<DefineButtonsButton> buttons_; // Vector con las nuevas definiciones de botones/acciones
int index_controller_; // Indice del controlador a reasignar
int index_button_; // Indice para saber qué bot´çon se está definiendo
int index_controller_ = 0; // Indice del controlador a reasignar
int index_button_ = 0; // Indice para saber qué bot´çon se está definiendo
std::vector<std::string> controller_names_; // Nombres de los mandos
// Incrementa el indice de los botones