Input: mogudes structs, enums i consts a la part publica
This commit is contained in:
@@ -8,24 +8,22 @@
|
||||
#include <utility>
|
||||
#include <vector> // Para vector
|
||||
|
||||
// Declaraciones adelantadas
|
||||
class Input;
|
||||
class Text;
|
||||
enum class InputAction : int;
|
||||
|
||||
// Estructura para definir botones
|
||||
struct DefineButtonsButton {
|
||||
std::string label; // Texto en pantalla
|
||||
InputAction input; // Acción asociada
|
||||
SDL_GamepadButton button; // Botón del mando
|
||||
|
||||
DefineButtonsButton(std::string lbl, InputAction inp, SDL_GamepadButton btn)
|
||||
: label(std::move(lbl)), input(inp), button(btn) {}
|
||||
};
|
||||
#include "input.h"
|
||||
#include "text.h"
|
||||
|
||||
// Clase DefineButtons
|
||||
class DefineButtons {
|
||||
public:
|
||||
// Estructura para definir botones
|
||||
struct Button {
|
||||
std::string label; // Texto en pantalla
|
||||
Input::Action action; // Acción asociada
|
||||
SDL_GamepadButton button; // Botón del mando
|
||||
|
||||
Button(std::string label, Input::Action action, SDL_GamepadButton button)
|
||||
: label(std::move(label)), action(action), button(button) {}
|
||||
};
|
||||
|
||||
DefineButtons();
|
||||
~DefineButtons() = default;
|
||||
|
||||
@@ -42,7 +40,7 @@ class DefineButtons {
|
||||
// Variables
|
||||
bool enabled_ = false; // Indica si está activo
|
||||
int x_ = 0, y_ = 0; // Coordenadas de texto
|
||||
std::vector<DefineButtonsButton> buttons_; // Definiciones de botones
|
||||
std::vector<Button> buttons_; // Definiciones de botones
|
||||
size_t index_controller_ = 0; // Índice del controlador asignado
|
||||
size_t index_button_ = 0; // Índice del botón en proceso
|
||||
std::vector<std::string> controller_names_; // Nombres de los mandos
|
||||
|
||||
Reference in New Issue
Block a user